:root {
  --bg-base: #f2ede4;
  --bg-surface: rgba(255, 250, 243, 0.88);
  --bg-surface-strong: #fffdf8;
  --bg-elevated: rgba(255, 255, 255, 0.96);
  --bg-hero: linear-gradient(140deg, rgba(14, 84, 78, 0.96), rgba(11, 107, 101, 0.9) 55%, rgba(27, 132, 125, 0.86));
  --bg-soft: rgba(241, 236, 228, 0.9);
  --bg-soft-strong: rgba(246, 240, 231, 0.98);
  --bg-ink: #163633;
  --text-primary: #1d2a28;
  --text-secondary: #4b5f5a;
  --text-muted: #667a75;
  --line-soft: rgba(22, 54, 51, 0.1);
  --line-strong: rgba(22, 54, 51, 0.16);
  --shadow-soft: 0 18px 42px rgba(39, 63, 58, 0.08);
  --shadow-hover: 0 24px 48px rgba(27, 61, 56, 0.16);
  --shadow-panel: 0 10px 24px rgba(20, 38, 34, 0.08);
  --teal-500: #127f74;
  --teal-600: #0c655c;
  --jade-500: #2db39d;
  --blue-500: #245d73;
  --amber-500: #d8941f;
  --red-500: #c7524a;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --spacing-xs: 0.5rem;
  --spacing-sm: 0.875rem;
  --spacing-md: 1.25rem;
  --spacing-lg: 1.75rem;
  --spacing-xl: 2.5rem;
  --transition-soft: 180ms ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text-primary);
  background:
    radial-gradient(circle at top left, rgba(45, 179, 157, 0.14), transparent 30%),
    radial-gradient(circle at 82% 16%, rgba(36, 93, 115, 0.12), transparent 20%),
    linear-gradient(180deg, #f6f1e8 0%, #efe7db 48%, #f4efe6 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
}

body::before {
  width: 420px;
  height: 420px;
  top: -140px;
  right: -120px;
  background: rgba(45, 179, 157, 0.08);
}

body::after {
  width: 320px;
  height: 320px;
  left: -140px;
  bottom: 12%;
  background: rgba(36, 93, 115, 0.08);
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
}

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

button {
  cursor: pointer;
}

.command-bar {
  position: sticky;
  top: 0;
  z-index: 120;
  padding: 1rem 1.5rem 0;
}

.command-bar__inner {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 24px;
  background: rgba(255, 251, 245, 0.84);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(32, 54, 49, 0.08);
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-size: 1.4rem;
  color: #fff;
  background: linear-gradient(135deg, var(--teal-600), var(--jade-500));
  box-shadow: 0 16px 28px rgba(18, 127, 116, 0.25);
}

.brand-kicker,
.panel-kicker,
.eyebrow,
.modal-kicker,
.section-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.brand-title,
.hero-title,
.section-title,
.modal-title,
.chat-title {
  margin: 0.15rem 0 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.command-nav {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.command-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 700;
  transition: transform var(--transition-soft), background var(--transition-soft), color var(--transition-soft), box-shadow var(--transition-soft);
}

.command-link:hover,
.command-link.is-active {
  color: var(--bg-ink);
  background: rgba(18, 127, 116, 0.1);
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(18, 127, 116, 0.12);
}

.command-status {
  min-width: 230px;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line-soft);
  transition: border-color var(--transition-soft), background var(--transition-soft);
}

.command-status__icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(18, 127, 116, 0.08);
  color: var(--teal-600);
}

.command-status__label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.command-status__text {
  margin: 0.12rem 0 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}

.command-status__meta {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.command-status[data-state="active"] {
  background: rgba(225, 248, 241, 0.92);
  border-color: rgba(45, 179, 157, 0.28);
}

.command-status[data-state="inactive"] {
  background: rgba(253, 242, 238, 0.92);
  border-color: rgba(199, 82, 74, 0.2);
}

.command-status[data-state="inactive"] .command-status__icon {
  background: rgba(199, 82, 74, 0.12);
  color: var(--red-500);
}

.dashboard-shell {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  gap: 1.5rem;
}

.hero-grid,
.content-grid,
.settings-grid,
.analytics-grid {
  display: grid;
  gap: 1.25rem;
}

.hero-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
}

.content-grid {
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
}

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

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

.hero-card,
.panel,
.metric-card,
.info-card,
.chat-shell,
.chart-card,
.settings-card,
.message-composer {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.hero-card {
  padding: 1.75rem;
  background: var(--bg-hero);
  color: #fff;
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -8% -20% auto;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.hero-title {
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.02;
}

.hero-copy,
.support-copy,
.card-copy {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.6;
}

.hero-copy {
  max-width: 54ch;
}

.hero-actions,
.stack-inline,
.panel-actions,
.filter-row,
.composer-actions,
.session-actions,
.top-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.35rem 1.5rem 0;
}

.panel-header--solid {
  padding: 1.4rem 1.5rem;
  color: #fff;
  background: linear-gradient(135deg, rgba(12, 101, 92, 0.98), rgba(45, 179, 157, 0.88));
}

.panel-title,
.section-title {
  margin: 0.2rem 0 0;
  font-size: 1.2rem;
}

.panel-content {
  padding: 1.5rem;
}

.panel-content--flush {
  padding-top: 0.8rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.metric-card {
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--teal-500), var(--jade-500));
}

.metric-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: rgba(18, 127, 116, 0.12);
  color: var(--teal-600);
}

.metric-value {
  margin: 1rem 0 0.35rem;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.metric-label {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.field-grid {
  display: grid;
  gap: 1rem;
}

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

.field {
  display: grid;
  gap: 0.45rem;
}

.field label,
.checkbox-group__title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea,
.search-input,
.composer-input {
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  padding: 0.9rem 1rem;
  color: var(--text-primary);
  transition: border-color var(--transition-soft), box-shadow var(--transition-soft), background var(--transition-soft);
}

.field textarea,
.composer-input {
  min-height: 120px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus,
.composer-input:focus {
  outline: none;
  border-color: rgba(18, 127, 116, 0.4);
  box-shadow: 0 0 0 4px rgba(18, 127, 116, 0.1);
}

.button {
  appearance: none;
  border: none;
  border-radius: 15px;
  padding: 0.95rem 1.15rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--teal-600), var(--jade-500));
  box-shadow: 0 16px 24px rgba(18, 127, 116, 0.18);
  transition: transform var(--transition-soft), box-shadow var(--transition-soft), opacity var(--transition-soft);
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 28px rgba(18, 127, 116, 0.22);
}

.button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button--ghost {
  color: var(--teal-600);
  background: rgba(18, 127, 116, 0.1);
  box-shadow: none;
}

.button--soft {
  color: var(--text-primary);
  background: rgba(22, 54, 51, 0.08);
  box-shadow: none;
}

.button--danger {
  color: #fff;
  background: linear-gradient(135deg, #b63d38, #d76057);
}

.button--full {
  width: 100%;
  justify-content: center;
}

.inline-chip,
.status-pill,
.subtle-pill,
.event-pill,
.metric-note {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
}

.inline-chip,
.subtle-pill {
  color: var(--teal-600);
  background: rgba(18, 127, 116, 0.1);
}

.status-pill[data-tone="success"] {
  color: var(--teal-600);
  background: rgba(45, 179, 157, 0.16);
}

.status-pill[data-tone="warning"] {
  color: var(--amber-500);
  background: rgba(216, 148, 31, 0.14);
}

.status-pill[data-tone="danger"] {
  color: var(--red-500);
  background: rgba(199, 82, 74, 0.12);
}

.status-pill[data-tone="neutral"] {
  color: var(--text-muted);
  background: rgba(22, 54, 51, 0.08);
}

.session-list,
.timeline,
.stack-list,
.settings-list,
.webhook-list {
  display: grid;
  gap: 0.95rem;
}

.session-card,
.timeline-item,
.chat-item,
.settings-list__item,
.webhook-item {
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(22, 54, 51, 0.08);
  transition: transform var(--transition-soft), box-shadow var(--transition-soft), border-color var(--transition-soft);
}

.session-card:hover,
.timeline-item:hover,
.chat-item:hover,
.webhook-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-panel);
}

.session-card__top,
.timeline-item__top,
.webhook-item__top,
.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.session-card__title,
.chat-item__title,
.timeline-item__title,
.settings-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.session-card__meta,
.timeline-item__meta,
.chat-item__meta,
.support-copy,
.muted {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  min-height: calc(100vh - 148px);
  overflow: hidden;
}

.chat-sidebar {
  background: rgba(252, 248, 241, 0.82);
  border-right: 1px solid rgba(22, 54, 51, 0.08);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.chat-sidebar__header,
.chat-thread__header {
  padding: 1.25rem;
  border-bottom: 1px solid rgba(22, 54, 51, 0.08);
}

.chat-thread__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.5);
}

.chat-sidebar__scroll,
.message-list,
.panel-scroll {
  overflow: auto;
}

.chat-sidebar__scroll {
  padding: 0.75rem;
  display: grid;
  gap: 0.75rem;
}

.chat-item {
  cursor: pointer;
}

.chat-item.is-active {
  border-color: rgba(18, 127, 116, 0.22);
  background: rgba(226, 246, 241, 0.92);
}

.chat-item__excerpt {
  margin: 0.45rem 0 0;
  color: var(--text-secondary);
  line-height: 1.45;
}

.chat-thread {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100%;
}

.message-list {
  padding: 1.25rem;
  display: grid;
  gap: 0.9rem;
  align-content: start;
  background:
    radial-gradient(circle at top left, rgba(45, 179, 157, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(246, 240, 231, 0.72));
}

.message-bubble {
  max-width: min(78%, 520px);
  padding: 0.95rem 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(22, 54, 51, 0.08);
  box-shadow: 0 10px 22px rgba(20, 38, 34, 0.06);
  justify-self: start;
}

.message-bubble--outbound {
  justify-self: end;
  background: rgba(221, 247, 235, 0.92);
  border-color: rgba(45, 179, 157, 0.18);
}

.message-bubble__text {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-bubble__meta,
.message-bubble__actions {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.message-bubble__actions button {
  border: none;
  background: transparent;
  padding: 0;
  color: var(--teal-600);
  font-weight: 800;
}

.message-composer {
  margin: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.88);
}

.composer-mode {
  margin-bottom: 0.8rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(18, 127, 116, 0.08);
  color: var(--text-secondary);
  display: none;
}

.composer-mode.is-visible {
  display: block;
}

.composer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
}

.analytics-cards,
.settings-panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.chart-wrap {
  position: relative;
  min-height: 340px;
}

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

.table th,
.table td {
  text-align: left;
  padding: 0.85rem 0.5rem;
  border-bottom: 1px solid rgba(22, 54, 51, 0.08);
}

.table th {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.checkbox-group {
  display: grid;
  gap: 0.75rem;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.checkbox {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
}

.checkbox input {
  width: 18px;
  height: 18px;
}

.empty-state {
  padding: 1.25rem;
  border-radius: 18px;
  border: 1px dashed rgba(22, 54, 51, 0.16);
  color: var(--text-muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.4);
}

.split-stat {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.split-stat__item {
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.split-stat__value {
  display: block;
  margin-top: 0.4rem;
  font-size: 1.2rem;
  font-weight: 800;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 1.5rem;
  background: rgba(16, 30, 28, 0.48);
  z-index: 200;
}

.modal.is-open {
  display: grid;
}

.modal__card {
  width: min(100%, 560px);
  border-radius: 28px;
  background: rgba(255, 252, 247, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 28px 54px rgba(16, 30, 28, 0.24);
  overflow: hidden;
}

.modal__header,
.modal__body,
.modal__footer {
  padding: 1.25rem 1.4rem;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  border-bottom: 1px solid rgba(22, 54, 51, 0.08);
}

.modal__footer {
  border-top: 1px solid rgba(22, 54, 51, 0.08);
}

.modal__close {
  border: none;
  background: rgba(22, 54, 51, 0.08);
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: var(--text-secondary);
}

.modal__result {
  min-height: 120px;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(22, 54, 51, 0.08);
}

.qr-box {
  display: grid;
  place-items: center;
  min-height: 220px;
}

.code-box {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.2rem, 4vw, 2rem);
  letter-spacing: 0.14em;
  text-align: center;
}

.toast-stack {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  display: grid;
  gap: 0.75rem;
  z-index: 240;
}

.toast {
  min-width: 280px;
  max-width: 360px;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  color: #fff;
  box-shadow: 0 22px 34px rgba(16, 30, 28, 0.2);
  animation: slideToast 180ms ease both;
}

.toast[data-tone="success"] {
  background: linear-gradient(135deg, #0b6b65, #2db39d);
}

.toast[data-tone="warning"] {
  background: linear-gradient(135deg, #ba7a10, #dca03a);
}

.toast[data-tone="danger"] {
  background: linear-gradient(135deg, #b63d38, #d76057);
}

.toast[data-tone="info"] {
  background: linear-gradient(135deg, #245d73, #3a88a6);
}

.utility-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.skeleton {
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  animation: shimmer 1.6s infinite;
}

.disabled-card {
  opacity: 0.72;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes slideToast {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .command-bar__inner,
  .hero-grid,
  .content-grid,
  .analytics-grid,
  .settings-grid,
  .metric-grid,
  .analytics-cards,
  .settings-panels {
    grid-template-columns: 1fr;
  }

  .chat-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .chat-sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(22, 54, 51, 0.08);
  }
}

@media (max-width: 820px) {
  .command-bar {
    padding: 0.9rem 0.9rem 0;
  }

  .command-bar__inner {
    grid-template-columns: 1fr;
  }

  .command-status {
    min-width: 0;
  }

  .dashboard-shell {
    padding: 1rem;
  }

  .field-grid--two,
  .checkbox-grid,
  .split-stat {
    grid-template-columns: 1fr;
  }

  .composer-row {
    grid-template-columns: 1fr;
  }

  .message-bubble {
    max-width: 100%;
  }
}
