:root {
  --bg: #edf1f5;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --panel-head-bg: #eef4f8;
  --field: #ffffff;
  --field-soft: #f5f8fb;
  --text: #1e293b;
  --muted: #64748b;
  --line: #ced8e5;
  --line-strong: #b3c0d0;
  --field-border: #b7c3d3;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #ec4899;
  --teal: #18a999;
  --soft-blue: #eff6ff;
  --soft-pink: #fdf2f8;
  --shadow: 0 22px 54px rgba(23, 32, 51, 0.12);
  --sidebar-closed: 68px;
  --sidebar-open: 228px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: linear-gradient(180deg, #f7f9fb 0%, var(--bg) 48%, #edf1f5 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

a {
  color: inherit;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

[hidden] {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
}

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

.auth-panel {
  position: relative;
  width: min(480px, 100%);
  display: grid;
  gap: 18px;
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-admin-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  color: var(--primary);
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}

.auth-brand {
  justify-self: end;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--primary-dark);
  font-weight: 900;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.auth-panel h1,
.topbar h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: 0;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label,
.context-bar label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.auth-form input,
.context-bar select,
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--field-border);
  border-radius: 8px;
  font-weight: 400;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
}

.auth-form input:focus-visible,
.context-bar select:focus-visible,
.form-grid input:focus-visible,
.form-grid select:focus-visible,
.form-grid textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  border-color: var(--primary);
}

.form-grid textarea {
  resize: vertical;
}

.password-field {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
}

.password-toggle-button,
.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  color: var(--primary);
  background: var(--field);
  border: 1px solid var(--field-border);
  border-radius: 8px;
  cursor: pointer;
}

.primary-action,
.secondary-action {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
}

.primary-action {
  color: #fff;
  background: var(--primary);
}

.primary-action:hover,
.primary-action:focus-visible {
  background: var(--primary-dark);
}

.primary-action:disabled {
  color: rgba(255, 255, 255, 0.82);
  background: #8fb2ff;
  cursor: not-allowed;
  opacity: 0.68;
}

.primary-action.small {
  min-height: 48px;
}

.primary-action.compact,
.secondary-action.compact {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.form-grid > .primary-action:not(.wide) {
  width: min(100%, 320px);
  justify-self: start;
}

.secondary-action {
  color: var(--primary);
  background: var(--soft-blue);
  border-color: rgba(37, 99, 235, 0.16);
}

.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.form-error {
  margin: 0;
  padding: 12px;
  color: #9f1239;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  font-weight: 800;
}

.form-success {
  margin: 0 0 14px;
  padding: 12px;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  font-weight: 800;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: var(--sidebar-closed);
  padding: 14px 10px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(180deg, #1e293b 0%, #172033 100%);
  transition: width 180ms ease;
}

.sidebar:hover,
.sidebar:focus-within {
  width: var(--sidebar-open);
}

.brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  min-height: 48px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  font-weight: 900;
}

.brand-name,
.nav-link span:last-child {
  opacity: 0;
  white-space: nowrap;
  transition: opacity 160ms ease;
}

.sidebar:hover .brand-name,
.sidebar:hover .nav-link span:last-child,
.sidebar:focus-within .brand-name,
.sidebar:focus-within .nav-link span:last-child {
  opacity: 1;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 22px;
}

.nav-link {
  min-height: 44px;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  border-radius: 8px;
}

.nav-icon {
  display: grid;
  place-items: center;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar-closed);
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58) 0%, rgba(255, 255, 255, 0) 220px),
    var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.user-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-weight: 800;
}

.status-pill.is-safe {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.status-pill.is-active {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.status-pill.is-warning {
  color: #9a3412;
  background: #fff7ed;
  border-color: #fdba74;
}

.status-pill.has-state {
  gap: 8px;
}

.status-pill-state {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  line-height: 1;
}

.status-pill-state.is-on {
  background: #047857;
}

.status-pill-state.is-off {
  background: #dc2626;
}

.network-pill.is-offline {
  color: #9f1239;
  background: #fff1f2;
  border-color: #fecdd3;
}

.logout-form {
  margin: 0;
}

.context-bar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.context-bar label {
  min-width: min(360px, 100%);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.quick-action {
  min-width: 0;
  min-height: 86px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: 3px 10px;
  align-items: center;
  padding: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(23, 32, 51, 0.08);
  text-decoration: none;
}

.quick-action:hover,
.quick-action:focus-visible {
  border-color: rgba(37, 99, 235, 0.36);
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.12);
}

.quick-icon {
  grid-row: 1 / 3;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--soft-blue);
  border-radius: 8px;
}

.quick-action strong,
.quick-action small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.quick-action strong {
  align-self: end;
  font-size: 14px;
}

.quick-action small {
  align-self: start;
  color: var(--muted);
  font-weight: 800;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(23, 32, 51, 0.1);
}

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

.stat-card span,
.stat-card small {
  color: var(--muted);
  font-weight: 800;
}

.stat-card strong {
  font-size: 34px;
  line-height: 1;
}

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

.split-grid,
.single-grid {
  display: grid;
  gap: 14px;
}

.split-grid {
  grid-template-columns: minmax(320px, 0.65fr) minmax(0, 1.35fr);
}

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

.panel {
  min-width: 0;
  overflow: hidden;
}

.form-panel {
  align-self: start;
  overflow: visible;
}

.panel-head {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--panel-head-bg);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: inset 4px 0 0 rgba(236, 72, 153, 0.78);
}

.panel h2 {
  margin: 0;
  font-size: 18px;
}

.service-editor-head {
  align-items: stretch;
  flex-wrap: wrap;
}

.service-editor-head h2 {
  align-self: center;
  min-width: min(520px, 100%);
}

.publish-box {
  display: grid;
  grid-template-columns: minmax(132px, 0.75fr) minmax(148px, 0.85fr) auto auto;
  gap: 10px;
  align-items: end;
  justify-content: end;
  width: min(980px, 100%);
  margin-left: auto;
}

.publish-box label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.publish-box input,
.publish-box select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--field-border);
  border-radius: 8px;
  font-weight: 400;
}

.publish-box .primary-action,
.publish-box .secondary-action {
  min-height: 42px;
  white-space: nowrap;
}

.panel-accordion > summary.panel-head {
  cursor: pointer;
  list-style: none;
}

.panel-accordion > summary.panel-head:focus {
  outline: none;
}

.panel-accordion > summary.panel-head::-webkit-details-marker {
  display: none;
}

.create-accordion > summary.panel-head::after {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  content: "+";
  color: var(--primary);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(23, 32, 51, 0.06);
}

.create-accordion[open] > summary.panel-head::after {
  content: "-";
}

.panel-accordion > summary.panel-head:hover::after,
.panel-accordion > summary.panel-head:focus-visible::after {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.create-toggle-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--primary);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(23, 32, 51, 0.06);
}

.create-toggle-button:hover,
.create-toggle-button:focus-visible {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.create-form-content {
  border-bottom: 1px solid var(--line-strong);
}

.form-grid {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.form-grid.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.agent-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}

.agent-form-grid .agent-grid-half {
  grid-column: span 2;
}

.agent-form-grid .agent-grid-third,
.agent-form-grid .agent-grid-quarter {
  grid-column: span 1;
}

.agent-form-grid .agent-grid-full {
  grid-column: 1 / -1;
}

.agent-form-grid textarea,
.agent-form-grid fieldset {
  min-height: 132px;
}

.agent-form-grid textarea[name="tone"] {
  min-height: 220px;
}

.agent-form-grid > .primary-action {
  align-self: end;
}

.platform-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}

.platform-form-grid .platform-grid-half {
  grid-column: span 2;
}

.platform-form-grid .platform-grid-quarter {
  grid-column: span 1;
}

.platform-form-grid > .primary-action {
  align-self: end;
}

.operator-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}

.operator-form-grid .operator-grid-half {
  grid-column: span 2;
}

.operator-form-grid .operator-grid-quarter {
  grid-column: span 1;
}

.operator-form-grid fieldset {
  min-height: 172px;
}

.operator-form-grid > .primary-action {
  align-self: end;
}

.agent-edit-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}

.agent-edit-grid .agent-grid-half {
  grid-column: span 2;
}

.agent-edit-grid .agent-grid-third,
.agent-edit-grid .agent-grid-quarter {
  grid-column: span 1;
}

.agent-edit-grid .agent-grid-full {
  grid-column: 1 / -1;
}

.agent-edit-grid textarea,
.agent-edit-grid fieldset {
  min-height: 132px;
}

.agent-edit-grid textarea[name="tone"] {
  min-height: 220px;
}

.agent-source-field textarea {
  min-height: 320px;
  line-height: 1.45;
}

.agent-edit-grid > .primary-action {
  align-self: end;
}

.agent-editor-layout {
  gap: 10px;
}

.agent-editor-title-panel .panel-head {
  border-bottom: 0;
}

.agent-editor-accordion > .panel-head {
  min-height: 58px;
}

.agent-editor-accordion > .panel-head::after {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  content: "+";
  color: var(--primary);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(23, 32, 51, 0.06);
}

.agent-editor-accordion[open] > .panel-head::after {
  content: "-";
}

.agent-editor-accordion > .panel-head:hover::after,
.agent-editor-accordion > .panel-head:focus-visible::after {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.agent-editor-accordion.is-dirty > .panel-head {
  background: #fff7ed;
}

.calendar-config-layout {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.calendar-setup-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.calendar-setup-flow li {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.calendar-setup-flow li > span,
.calendar-step-number {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--primary);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-weight: 900;
}

.calendar-setup-flow li.is-current {
  color: var(--text);
  border-color: var(--primary);
  background: #f5f8ff;
}

.calendar-setup-flow li.is-complete > span {
  color: #fff;
  background: #047857;
  border-color: #047857;
}

.calendar-config-step {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}

.calendar-config-summary,
.calendar-editor-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  list-style: none;
}

.calendar-config-summary {
  min-height: 72px;
  padding: 12px 16px;
  background: var(--panel-head-bg);
}

.calendar-config-summary::-webkit-details-marker,
.calendar-editor-summary::-webkit-details-marker {
  display: none;
}

.calendar-step-title,
.calendar-editor-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-step-title > span:last-child,
.calendar-editor-main > span:last-child,
.calendar-connection-row > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.calendar-step-title strong,
.calendar-editor-main strong,
.calendar-connection-row strong {
  overflow-wrap: anywhere;
}

.calendar-step-title small,
.calendar-editor-main small,
.calendar-connection-row small {
  color: var(--muted);
  font-weight: 700;
}

.calendar-config-body {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.calendar-connection-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.meeting-account-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.meeting-account-name {
  min-width: 0;
  display: flex;
  align-items: end;
  gap: 8px;
  margin: 0;
}

.meeting-account-name > label,
.meeting-account-name > span,
.meeting-account-status {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.meeting-account-name > label {
  flex: 1 1 auto;
}

.meeting-account-name small,
.meeting-account-status small {
  color: var(--muted);
  font-weight: 700;
}

.meeting-account-status {
  align-content: end;
  justify-items: start;
  padding-bottom: 3px;
}

.calendar-editor-item {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.calendar-editor-summary {
  min-height: 66px;
  padding: 10px 12px;
}

.calendar-editor-summary:hover,
.calendar-editor-summary:focus-visible {
  background: #f8fafc;
}

.calendar-editor-item[open] > .calendar-editor-summary {
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.calendar-editor-body {
  padding: 14px;
}

.booking-service-list {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.booking-service-list-head {
  display: grid;
  gap: 3px;
  padding: 2px 2px 4px;
}

.booking-service-list-head > span,
.booking-exact-hours-heading > span {
  color: var(--muted);
  font-weight: 700;
}

.booking-service-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

.booking-service-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent);
}

.booking-service-summary {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

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

.booking-service-card[open] > .booking-service-summary {
  background: #f8fafc;
}

.booking-service-summary-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.booking-service-selector {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  cursor: pointer;
}

.booking-service-selector input {
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--primary);
}

.booking-service-title {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.booking-service-title strong {
  overflow-wrap: anywhere;
}

.booking-service-title small {
  color: var(--muted);
  font-weight: 700;
}

.booking-service-body {
  padding: 14px;
  border-top: 1px solid var(--line);
}

.booking-service-modalities {
  padding: 12px;
}

.booking-service-modalities legend {
  color: var(--text);
}

.booking-modality-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.booking-modality-options label {
  min-width: 130px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
}

.booking-modality-options input {
  width: 20px;
  min-height: 20px;
  margin: 0;
  accent-color: var(--primary);
}

.booking-service-modalities small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-weight: 700;
}

.meeting-provider-config {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.meeting-provider-config > p,
.meeting-provider-config > div {
  align-self: end;
  margin: 0;
}

.meeting-provider-actions {
  min-height: 44px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.booking-service-body > .muted-copy:not(.wide) {
  align-self: end;
  margin: 0 0 12px;
}

.booking-exact-hours-heading {
  display: grid;
  gap: 3px;
  padding-top: 4px;
}

.booking-weekly-starts {
  display: grid;
  gap: 10px;
}

.booking-weekly-starts > .muted-copy {
  margin: 0 0 2px;
}

.booking-day-editor {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.booking-day-editor > summary {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  cursor: pointer;
  list-style: none;
}

.booking-day-editor > summary::-webkit-details-marker {
  display: none;
}

.booking-day-editor[open] > summary {
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.booking-day-body,
.booking-start-list {
  display: grid;
  gap: 10px;
}

.booking-day-body {
  padding: 12px;
}

.booking-start-row {
  display: grid;
  grid-template-columns: minmax(160px, 350px) 44px;
  align-items: end;
  justify-content: start;
  gap: 10px;
}

.booking-start-row label,
.booking-start-actions label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.booking-start-remove svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.booking-start-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 2px;
}

.booking-start-actions label {
  width: min(100%, 360px);
}

.booking-interval-field {
  width: min(100%, 350px);
}

.booking-start-add {
  flex: 0 0 auto;
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.calendar-edit-icon,
.calendar-add-icon {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--primary);
  background: #f5f8ff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.calendar-edit-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.calendar-add-icon {
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.calendar-add-item {
  border-style: dashed;
}

.calendar-empty-state {
  margin: 0;
  padding: 6px 2px;
  color: var(--muted);
}

.agent-unsaved-note {
  margin-left: auto;
  padding: 5px 9px;
  color: #9a3412;
  background: #ffedd5;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.agent-accordion-save {
  flex: 0 0 auto;
}

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

.agent-source-section-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 16px;
}

.agent-source-section-form .agent-source-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-weight: 800;
}

.agent-source-section-form .agent-source-field textarea {
  width: 100%;
  min-height: 340px;
  padding: 11px 13px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--field-border);
  border-radius: 8px;
  font-weight: 400;
  line-height: 1.45;
  resize: vertical;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
}

.agent-source-section-form .agent-source-field textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  border-color: var(--primary);
}

.form-note {
  padding: 12px 14px;
  color: var(--muted);
  background: var(--field-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.agent-tree-field {
  align-content: start;
}

.agent-tree-card {
  width: 100%;
  display: grid;
  gap: 12px;
  padding: 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  font-weight: 700;
}

.agent-tree-card strong {
  width: auto;
  font-weight: 900;
  white-space: normal;
}

.agent-tree-root {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 10px 12px;
  background: var(--soft-blue);
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
}

.agent-tree-root strong {
  font-size: 17px;
}

.agent-tree-platforms {
  display: grid;
  gap: 10px;
}

.agent-tree-platform {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--field-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.agent-tree-platform-head,
.agent-tree-service {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-tree-platform-head strong {
  font-size: 16px;
}

.agent-tree-platform-head span,
.agent-tree-service span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.agent-tree-platform ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.agent-tree-service {
  min-height: 38px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.agent-tree-service a {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.agent-tree-service a:hover,
.agent-tree-service a:focus-visible {
  color: var(--primary);
  text-decoration: underline;
}

.agent-tree-empty {
  padding: 10px 12px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  font-weight: 800;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.form-grid-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.connection-card {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px 7px 13px;
  color: var(--text);
  background: var(--field-soft);
  border: 1px solid var(--field-border);
  border-radius: 8px;
}

.connection-card strong {
  font-size: 15px;
  font-weight: 800;
}

.connection-card.is-empty strong {
  color: var(--muted);
}

.whatsapp-link-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  padding: 16px;
}

.whatsapp-link-copy {
  display: grid;
  align-content: start;
  gap: 14px;
}

.muted-copy {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.form-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.form-actions-row .primary-action,
.form-actions-row .secondary-action {
  min-width: 180px;
}

.qr-card {
  min-height: 320px;
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--field-border);
  border-radius: 8px;
}

.qr-card img {
  display: block;
  width: min(100%, 300px);
  height: auto;
}

.qr-card.is-empty {
  gap: 8px;
  align-content: center;
  color: var(--muted);
  background: var(--field-soft);
  text-align: center;
}

.qr-card.is-empty strong {
  color: var(--text);
  font-size: 18px;
}

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

fieldset {
  min-width: 0;
  margin: 0;
  padding: 16px;
  background: var(--field-soft);
  border: 1px solid var(--field-border);
  border-radius: 8px;
}

legend {
  float: left;
  width: 100%;
  padding: 0;
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 900;
  line-height: 1.2;
}

legend + * {
  clear: both;
}

.check-grid {
  display: grid;
  gap: 8px;
}

.check-line {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.check-line input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

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

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

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

th,
td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  background: var(--surface-alt);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

tbody tr:nth-child(even) {
  background: #fbfcfe;
}

.history-summary-row {
  cursor: pointer;
}

.history-summary-row:hover,
.history-summary-row.is-open {
  background: #f8fbff;
}

.history-summary-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.history-toggle-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--primary);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.history-toggle-button:hover,
.history-toggle-button:focus-visible {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.history-fields-summary strong {
  display: block;
}

.history-detail-row > td {
  padding: 0 16px 16px 16px;
  background: #fff;
}

.history-detail-panel {
  width: 100%;
  padding: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
}

td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.conversations-table .conversation-platform-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversations-table .conversation-last-message-cell {
  max-width: 420px;
}

.conversations-table .conversation-last-message-text {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-body {
  padding: 16px;
}

.handoff-history-list {
  display: grid;
  gap: 0;
  padding: 0;
}

.handoff-history-accordion {
  background: #f8fafc;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.handoff-history-accordion > summary.panel-head {
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) minmax(240px, 0.85fr) minmax(150px, 0.55fr) auto auto auto;
  gap: 14px;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  background: #f3f7fb;
  border-bottom: 0;
  box-shadow: none;
}

.handoff-history-accordion > summary.panel-head::after {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  justify-self: end;
  content: "+";
  color: var(--primary);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  box-shadow: none;
}

.handoff-history-accordion[open] > summary.panel-head::after {
  content: "-";
}

.handoff-history-accordion > summary.panel-head:hover::after,
.handoff-history-accordion > summary.panel-head:focus-visible::after {
  color: var(--primary-dark);
  background: transparent;
  border-color: transparent;
}

.handoff-history-heading {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}

.handoff-history-heading strong,
.handoff-history-heading span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.handoff-history-heading strong {
  display: inline;
}

.handoff-history-heading span {
  display: inline;
  margin-top: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.handoff-history-heading:not(:first-child) span::after {
  content: ":";
}

.handoff-history-context {
  justify-self: end;
  white-space: nowrap;
}

.handoff-history-accordion > summary.panel-head form {
  justify-self: end;
}

.handoff-history-context.secondary-action {
  min-height: 34px;
  padding-inline: 16px;
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: none;
}

.handoff-history-accordion > summary.panel-head:hover .handoff-history-context.secondary-action,
.handoff-history-accordion > summary.panel-head:focus-visible .handoff-history-context.secondary-action,
.handoff-history-context.secondary-action:hover,
.handoff-history-context.secondary-action:focus-visible {
  color: #fff;
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: none;
}

.handoff-history-body {
  border-top: 1px solid var(--line);
}

.handoff-history-table td:nth-child(3),
.handoff-history-table td:nth-child(4) {
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .handoff-history-accordion > summary.panel-head {
    grid-template-columns: minmax(180px, 1fr) minmax(170px, 0.75fr) auto auto auto auto;
  }

  .handoff-history-context {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .handoff-history-accordion > summary.panel-head {
    grid-template-columns: 1fr auto auto;
  }

  .handoff-history-context {
    justify-self: start;
  }
}

code {
  color: #0f766e;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  word-break: break-word;
}

.state-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.state-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.state-item span {
  color: var(--muted);
}

.service-detail-list,
.agent-detail-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.state-block {
  align-items: flex-start;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 60px;
}

.state-block strong {
  width: 100%;
  font-weight: 500;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.state-block .agent-tree-card strong {
  width: auto;
  font-weight: 900;
  white-space: normal;
}

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

.state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 8px;
  color: #0f766e;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

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

.table-actions form {
  margin: 0;
}

.services-table th:nth-child(n + 3),
.services-table td:nth-child(n + 3) {
  text-align: center;
}

.services-table .table-actions {
  justify-content: center;
}

.platforms-table th:nth-child(n + 3),
.platforms-table td:nth-child(n + 3),
.agents-table th:nth-child(n + 4),
.agents-table td:nth-child(n + 4) {
  text-align: center;
}

.platforms-table .table-actions,
.agents-table .table-actions {
  justify-content: center;
}

.action-icon-row {
  align-items: center;
}

.action-icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  color: var(--primary);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.action-icon-button:hover,
.action-icon-button:focus-visible {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.action-icon-button.is-live {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.action-icon-button.is-live:hover,
.action-icon-button.is-live:focus-visible {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.action-icon-button svg {
  width: 18px;
  height: 18px;
}

.aton-state-indicator {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.aton-state-indicator svg {
  width: 18px;
  height: 18px;
}

.aton-state-indicator.is-active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.aton-state-indicator.is-alert {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
}

.aton-data-grid {
  max-width: none;
  grid-template-columns: minmax(260px, 0.9fr) minmax(280px, 1.2fr) minmax(260px, 1fr);
  align-items: stretch;
}

.aton-readonly-field {
  min-height: 78px;
  padding: 12px 14px;
  background: var(--field-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.aton-admin-field {
  align-content: start;
  gap: 10px;
}

.aton-admin-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.aton-admin-row > span {
  min-width: 64px;
  color: var(--muted);
  font-weight: 800;
}

.aton-role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.aton-data-grid > label,
.aton-name-field {
  min-height: 78px;
}

.aton-name-field {
  display: grid;
  align-content: start;
  gap: 8px;
}

.aton-name-field > label {
  color: var(--muted);
  font-weight: 800;
}

.aton-name-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
  align-items: center;
}

.aton-name-control input {
  min-width: 0;
}

.aton-name-control .action-icon-button {
  width: 46px;
  height: 46px;
}

.aton-readonly-field strong {
  color: var(--text);
}

.aton-profile-form {
  display: none;
}

.aton-status-badge {
  width: fit-content;
  min-width: 46px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 11px;
  color: #fff !important;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.aton-status-badge.is-on {
  background: #047857;
}

.aton-status-badge.is-off {
  background: #dc2626;
}

.aton-whatsapp-editor {
  max-width: 100%;
  margin-top: 10px;
  padding: 0;
}

.aton-whatsapp-editor > summary {
  width: fit-content;
  cursor: pointer;
  list-style: none;
}

.aton-whatsapp-editor > summary::-webkit-details-marker {
  display: none;
}

.aton-whatsapp-form {
  margin-top: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.aton-contact-create-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.aton-contacts-table th:last-child,
.aton-contacts-table td:last-child {
  width: 160px;
  text-align: center;
}

.aton-contacts-table .table-actions {
  justify-content: center;
}

.aton-table-input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.aton-table-input:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  border-color: var(--primary);
}

.aton-empty-row {
  padding: 18px 24px;
  color: var(--muted);
}

.aton-chat-shell {
  max-width: 490px;
  height: clamp(520px, calc(100vh - 148px), 720px);
  margin-inline: auto;
}

.aton-chat-panel {
  position: relative;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.aton-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.aton-chat-head h2 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aton-chat-head-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.aton-chat-popout-action {
  flex: 0 0 auto;
}

.chat-popup-page {
  min-height: 100vh;
  background: var(--bg);
}

.chat-popup-page .aton-chat-shell {
  width: 100vw;
  max-width: none;
  height: 100vh;
  margin: 0;
  padding-inline: clamp(0px, calc((100vw - 490px) / 2), 35px);
}

.chat-popup-page .aton-chat-panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.aton-chat-thread {
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.aton-chat-jump {
  position: absolute;
  left: 50%;
  z-index: 3;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 14px 28px rgba(23, 32, 51, 0.16);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.aton-chat-jump::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.aton-chat-jump.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.aton-chat-jump:hover,
.aton-chat-jump:focus-visible {
  box-shadow: 0 18px 34px rgba(37, 99, 235, 0.2);
  outline: 3px solid rgba(37, 99, 235, 0.14);
}

.aton-chat-empty {
  margin: auto;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.aton-chat-message {
  max-width: min(720px, 92%);
  position: relative;
  margin-bottom: 22px;
  padding: 12px 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.aton-chat-message.is-user {
  align-self: flex-end;
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.aton-chat-panel.is-client-test-chat .aton-chat-message.is-user {
  background: var(--accent);
  border-color: var(--accent);
}

.aton-chat-message.is-assistant {
  align-self: flex-start;
}

.aton-chat-message.is-system {
  align-self: center;
  color: #9a3412;
  background: #fff7ed;
  border-color: #fed7aa;
}

.aton-chat-message.is-pending {
  opacity: 0.86;
}

.aton-chat-meta {
  display: none;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.aton-chat-message.is-user .aton-chat-meta {
  color: rgba(255, 255, 255, 0.78);
}

.aton-chat-message p {
  margin: 0;
  white-space: pre-wrap;
}

.aton-typing-indicator {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.aton-typing-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  background: var(--muted);
  border-radius: 999px;
  opacity: 0.56;
  animation: aton-typing-bounce 880ms infinite ease-in-out;
}

.aton-typing-dot:nth-child(2) {
  animation-delay: 140ms;
}

.aton-typing-dot:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes aton-typing-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.48;
  }

  40% {
    transform: translateY(-5px);
    opacity: 0.92;
  }
}

.aton-chat-time {
  position: absolute;
  top: calc(100% + 6px);
  left: 12px;
  min-height: 14px;
  margin-top: 0;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  opacity: 0;
  transition: opacity 140ms ease;
}

.aton-chat-message:hover .aton-chat-time,
.aton-chat-message:focus-within .aton-chat-time {
  opacity: 1;
}

.aton-chat-message.is-user .aton-chat-time {
  right: 12px;
  left: auto;
  color: #94a3b8;
  text-align: right;
}

.aton-chat-message.is-system .aton-chat-time {
  right: auto;
  left: 50%;
  color: #9a3412;
  text-align: center;
  transform: translateX(-50%);
}

.aton-chat-form {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  align-items: end;
  gap: 12px;
  padding: 14px;
  background: #fff;
}

.aton-chat-form textarea {
  width: 100%;
  height: 52px;
  min-height: 52px;
  max-height: 280px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  overflow-y: hidden;
  resize: vertical;
}

.aton-chat-form textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  border-color: var(--primary);
}

.aton-chat-form .primary-action {
  min-height: 52px;
}

.chat-popup-page .aton-chat-form {
  grid-template-columns: minmax(0, 1fr) minmax(108px, 130px);
}

.aton-chat-send-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.aton-chat-send-action svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  transform: rotate(-45deg);
  transform-origin: center;
}

@media (max-width: 430px) {
  .chat-popup-page .aton-chat-form {
    grid-template-columns: 1fr;
  }

  .chat-popup-page .aton-chat-send-action {
    min-height: 46px;
  }
}

.action-icon-button.is-disabled {
  color: var(--muted);
  background: #f8fafc;
  cursor: not-allowed;
  opacity: 0.52;
}

.action-icon-button.is-disabled:hover,
.action-icon-button.is-disabled:focus-visible {
  color: var(--muted);
  background: #f8fafc;
  border-color: var(--line);
}

.diff-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.diff-list li {
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  background: var(--field-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.diff-values span {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.diff-values small {
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.diff-more {
  color: var(--muted);
  font-weight: 800;
}

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

  .aton-data-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .aton-chat-shell {
    max-width: 490px;
  }

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

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

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

  .publish-box {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
}

@media (max-width: 720px) {
  .sidebar {
    width: 100%;
    height: 64px;
    inset: auto 0 0 0;
    display: flex;
    overflow-x: auto;
    padding: 8px;
  }

  .sidebar:hover,
  .sidebar:focus-within {
    width: 100%;
  }

  .brand {
    display: none;
  }

  .nav {
    display: flex;
    gap: 6px;
    margin: 0;
  }

  .nav-link {
    grid-template-columns: 40px;
    width: 44px;
  }

  .nav-link span:last-child {
    display: none;
  }

  .app-main {
    margin-left: 0;
    padding: 16px 16px 84px;
  }

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

  .topbar-actions,
  .context-bar {
    width: 100%;
  }

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

  .user-pill {
    min-width: 0;
    flex: 1;
  }

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

  .quick-action {
    min-height: 74px;
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 10px;
  }

  .quick-icon {
    width: 38px;
    height: 38px;
  }

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

  .meeting-provider-config {
    grid-template-columns: 1fr;
  }

  .calendar-setup-flow {
    grid-template-columns: 1fr;
  }

  .calendar-config-summary,
  .calendar-editor-summary,
  .booking-service-summary,
  .calendar-connection-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .meeting-account-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .meeting-account-name {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-config-summary > .status-pill,
  .calendar-editor-summary > .status-pill,
  .booking-service-summary > .status-pill {
    margin-left: 48px;
  }

  .booking-start-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .booking-start-actions label {
    width: 100%;
  }

  .booking-start-row {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .booking-start-add {
    align-self: flex-end;
  }

  .aton-data-grid,
  .aton-contact-create-form {
    grid-template-columns: 1fr;
  }

  .aton-chat-shell {
    height: calc(100dvh - 190px);
    min-height: 360px;
  }

  .aton-chat-thread {
    max-height: none;
    padding: 14px;
  }

  .aton-chat-message {
    max-width: 100%;
  }

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

  .agent-source-section-form {
    grid-template-columns: 1fr;
  }

  .agent-source-section-form .action-icon-button {
    margin-top: 0;
    justify-self: end;
  }

  .publish-box {
    grid-template-columns: 1fr;
  }


  .service-detail-list,
  .agent-detail-list {
    grid-template-columns: 1fr;
  }

  .diff-values {
    grid-template-columns: 1fr;
  }

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

  .agent-form-grid .agent-grid-half,
  .agent-form-grid .agent-grid-third,
  .agent-form-grid .agent-grid-quarter,
  .agent-form-grid .agent-grid-full {
    grid-column: 1 / -1;
  }

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

  .platform-form-grid .platform-grid-half,
  .platform-form-grid .platform-grid-quarter {
    grid-column: 1 / -1;
  }

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

  .operator-form-grid .operator-grid-half,
  .operator-form-grid .operator-grid-quarter {
    grid-column: 1 / -1;
  }

  .agent-edit-grid {
    grid-template-columns: 1fr;
  }

  .agent-edit-grid .agent-grid-half,
  .agent-edit-grid .agent-grid-third,
  .agent-edit-grid .agent-grid-quarter,
  .agent-edit-grid .agent-grid-full {
    grid-column: 1 / -1;
  }

  .whatsapp-link-layout {
    grid-template-columns: 1fr;
  }

  .qr-card {
    min-height: 260px;
  }

  .auth-panel {
    padding: 28px 20px;
  }
}
