* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

:root {
  color-scheme: dark;
  --bg: #0f172a;
  --page: #111827;
  --surface: #172033;
  --surface-2: #1f2937;
  --surface-3: #273449;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --subtle: #94a3b8;
  --border: #334155;
  --field-bg: #ffffff;
  --field-text: #111827;
  --field-placeholder: #64748b;
  --primary: #06b6d4;
  --primary-strong: #0891b2;
  --primary-text: #062d35;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --secondary: #8b5cf6;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --page: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #e2e8f0;
  --text: #0f172a;
  --muted: #334155;
  --subtle: #64748b;
  --border: #cbd5e1;
  --field-bg: #ffffff;
  --field-text: #0f172a;
  --field-placeholder: #64748b;
  --primary: #0e7490;
  --primary-strong: #155e75;
  --primary-text: #ecfeff;
  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;
  --secondary: #6d28d9;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.14);
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--page);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

.material-symbols-outlined {
  display: inline-flex;
  width: 1.5rem;
  height: 1.5rem;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 24px;
}

.material-symbols-outlined::before {
  content: attr(data-icon);
  font-family: "Material Symbols Outlined", "Segoe UI Symbol", sans-serif;
  font-size: 24px;
  line-height: 1;
}

.material-symbols-outlined[data-icon] {
  font-size: 0;
}

.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.grid {
  display: grid;
}

.block {
  display: block;
}

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

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

.sticky {
  position: sticky;
}

.inset-0 {
  inset: 0;
}

.top-0 {
  top: 0;
}

.left-0 {
  left: 0;
}

.right-0 {
  right: 0;
}

.bottom-0 {
  bottom: 0;
}

.z-40 {
  z-index: 40;
}

.z-50 {
  z-index: 50;
}

.h-screen {
  height: 100vh;
}

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

.h-16 {
  height: 4rem;
}

.h-8 {
  height: 2rem;
}

.h-10 {
  height: 2.5rem;
}

.h-24 {
  height: 6rem;
}

.h-64 {
  height: 16rem;
}

.h-full {
  height: 100%;
}

.w-2 {
  width: 0.5rem;
}

.h-2 {
  height: 0.5rem;
}

.w-8 {
  width: 2rem;
}

.w-10 {
  width: 2.5rem;
}

.w-11 {
  width: 2.75rem;
}

.w-24 {
  width: 6rem;
}

.w-64 {
  width: 16rem;
}

.w-72 {
  width: 18rem;
}

.w-full {
  width: 100%;
}

.max-w-\[78\%\] {
  max-width: 78%;
}

.flex-1 {
  flex: 1 1 0%;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.justify-end {
  justify-content: flex-end;
}

.gap-1 {
  gap: 0.25rem;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

.gap-6 {
  gap: 1.5rem;
}

.gap-8 {
  gap: 2rem;
}

.space-y-2 > * + * {
  margin-top: 0.5rem;
}

.space-y-3 > * + * {
  margin-top: 0.75rem;
}

.space-y-4 > * + * {
  margin-top: 1rem;
}

.space-y-6 > * + * {
  margin-top: 1.5rem;
}

.space-y-8 > * + * {
  margin-top: 2rem;
}

.p-2 {
  padding: 0.5rem;
}

.p-3 {
  padding: 0.75rem;
}

.p-4 {
  padding: 1rem;
}

.p-6 {
  padding: 1.5rem;
}

.p-8 {
  padding: 2rem;
}

.p-margin-desktop {
  padding: 2rem;
}

.px-2 {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.px-3 {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.px-6 {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.px-8 {
  padding-left: 2rem;
  padding-right: 2rem;
}

.px-margin-desktop {
  padding-left: 2rem;
  padding-right: 2rem;
}

.py-1 {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.py-2 {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.py-3 {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.py-4 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.py-5 {
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.py-6 {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.py-8 {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.py-10 {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.pl-10 {
  padding-left: 2.5rem;
}

.pr-4 {
  padding-right: 1rem;
}

.pt-4 {
  padding-top: 1rem;
}

.pt-6 {
  padding-top: 1.5rem;
}

.pt-10 {
  padding-top: 2.5rem;
}

.mb-1 {
  margin-bottom: 0.25rem;
}

.mb-3 {
  margin-bottom: 0.75rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-8 {
  margin-bottom: 2rem;
}

.mt-1 {
  margin-top: 0.25rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mt-6 {
  margin-top: 1.5rem;
}

.ml-4 {
  margin-left: 1rem;
}

.overflow-hidden {
  overflow: hidden;
}

.overflow-x-hidden {
  overflow-x: hidden;
}

.overflow-y-auto {
  overflow-y: auto;
}

.rounded {
  border-radius: 0.25rem;
}

.rounded-lg {
  border-radius: 0.5rem;
}

.rounded-xl {
  border-radius: 0.75rem;
}

.rounded-2xl {
  border-radius: 1rem;
}

.rounded-full {
  border-radius: 9999px;
}

.border {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.border-r {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.border-r-2 {
  border-right: 2px solid #4edea3;
}

.border-t {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.border-b {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.border-none {
  border: 0;
}

.divide-y > * + * {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.bg-surface,
.bg-background {
  background-color: #0b1326;
}

.bg-surface-dim\/80 {
  background-color: rgba(11, 19, 38, 0.8);
}

.bg-surface-container-low,
.bg-surface-container-low\/60,
.bg-surface-container-low\/80 {
  background-color: rgba(19, 27, 46, 0.82);
}

.bg-surface-container-high,
.bg-surface-container-high\/40,
.bg-surface-container-high\/50 {
  background-color: rgba(34, 42, 61, 0.75);
}

.bg-surface-container-highest {
  background-color: #2d3449;
}

.bg-surface-variant\/20,
.bg-surface-variant\/30,
.bg-surface-variant\/40 {
  background-color: rgba(45, 52, 73, 0.45);
}

.bg-secondary-container\/20 {
  background-color: rgba(87, 27, 193, 0.22);
}

.bg-primary-container,
.bg-primary-container\/15,
.bg-primary-container\/40 {
  background-color: rgba(0, 240, 255, 0.18);
}

.bg-tertiary-container\/10,
.bg-tertiary-container\/15,
.bg-tertiary-container\/20 {
  background-color: rgba(101, 242, 181, 0.16);
}

.bg-error-container\/15,
.bg-error-container\/20,
.bg-error-container\/30 {
  background-color: rgba(147, 0, 10, 0.28);
}

.bg-primary-fixed-dim,
.bg-primary-fixed-dim\/15 {
  background-color: #00dbe9;
}

.bg-secondary {
  background-color: #d0bcff;
}

.bg-emerald-500 {
  background-color: #10b981;
}

.bg-gray-500 {
  background-color: #6b7280;
}

.text-on-surface {
  color: #dae2fd;
}

.text-on-surface-variant {
  color: #b9cacb;
}

.text-primary-fixed,
.text-primary-fixed-dim,
.text-surface-tint {
  color: #00dbe9;
}

.text-primary-container,
.text-on-primary-container {
  color: #00363a;
}

.text-on-primary {
  color: #00363a;
}

.text-tertiary-fixed-dim {
  color: #4edea3;
}

.text-secondary {
  color: #d0bcff;
}

.text-error {
  color: #ffb4ab;
}

.text-label-sm {
  font-size: 12px;
  line-height: 16px;
}

.text-label-md {
  font-size: 14px;
  line-height: 20px;
}

.text-body-md {
  font-size: 16px;
  line-height: 24px;
}

.text-body-lg {
  font-size: 18px;
  line-height: 28px;
}

.text-headline-md {
  font-size: 24px;
  line-height: 32px;
}

.text-headline-lg {
  font-size: 32px;
  line-height: 40px;
}

.text-display-lg {
  font-size: 48px;
  line-height: 56px;
}

.text-\[10px\] {
  font-size: 10px;
}

.text-\[11px\] {
  font-size: 11px;
}

.text-\[20px\] {
  font-size: 20px;
}

.text-sm {
  font-size: 0.875rem;
}

.font-bold {
  font-weight: 700;
}

.font-black {
  font-weight: 900;
}

.font-label-md,
.font-label-sm,
.font-headline-md,
.font-headline-lg,
.font-display-lg {
  font-family: Geist, Inter, system-ui, sans-serif;
}

.uppercase {
  text-transform: uppercase;
}

.tracking-tight {
  letter-spacing: 0;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

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

.break-words {
  overflow-wrap: break-word;
}

.whitespace-pre-wrap {
  white-space: pre-wrap;
}

.opacity-0 {
  opacity: 0;
}

.opacity-10 {
  opacity: 0.1;
}

.opacity-60 {
  opacity: 0.6;
}

.pointer-events-none {
  pointer-events: none;
}

.transition-all,
.transition-colors {
  transition: all 0.18s ease;
}

.shadow-sm {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.glass-panel,
.glass-card {
  background: rgba(30, 41, 59, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 24px -1px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(20px);
}

.backdrop-blur-xl,
.backdrop-blur-2xl {
  backdrop-filter: blur(20px);
}

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

.min-h-\[400px\] {
  min-height: 400px;
}

.translate-x-full {
  transform: translateX(100%);
}

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

input,
select,
textarea {
  color: #dae2fd;
  background: rgba(34, 42, 61, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
}

input::placeholder,
textarea::placeholder {
  color: #849495;
}

button:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (min-width: 768px) {
  .md\:block {
    display: block !important;
  }

  .md\:hidden {
    display: none !important;
  }

  .md\:flex-row {
    flex-direction: row;
  }

  .md\:items-end {
    align-items: flex-end;
  }

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

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

@media (min-width: 1024px) {
  .lg\:flex {
    display: flex !important;
  }

  .lg\:hidden {
    display: none !important;
  }

  .lg\:ml-72 {
    margin-left: 18rem;
  }

  .lg\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .lg\:grid-cols-12 {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .lg\:col-span-4 {
    grid-column: span 4 / span 4;
  }

  .lg\:col-span-8 {
    grid-column: span 8 / span 8;
  }
}

@media (max-width: 767px) {
  .p-margin-desktop,
  .px-margin-desktop {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .text-display-lg {
    font-size: 32px;
    line-height: 40px;
  }

  main {
    padding-bottom: 5rem !important;
  }
}

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

.max-w-md {
  max-width: 28rem;
}

.max-w-2xl {
  max-width: 42rem;
}

.max-h-\[90vh\] {
  max-height: 90vh;
}

.min-h-\[140px\] {
  min-height: 140px;
}

.mx-8 {
  margin-left: 2rem;
  margin-right: 2rem;
}

/* Readability and theme overrides */
.bg-background,
.bg-surface,
.bg-surface-dim\/80 {
  background: var(--page) !important;
}

.bg-surface-container-low,
.bg-surface-container-low\/60,
.bg-surface-container-low\/80,
.bg-surface-container-high,
.bg-surface-container-high\/40,
.bg-surface-container-high\/50,
.bg-surface-container-highest,
.bg-surface-variant\/20,
.bg-surface-variant\/30,
.bg-surface-variant\/40 {
  background: var(--surface-2) !important;
}

.glass-panel,
.glass-card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
  backdrop-filter: blur(14px);
}

.text-on-background,
.text-on-surface,
.font-headline-md,
.font-headline-lg,
.font-display-lg {
  color: var(--text) !important;
}

.text-on-surface-variant {
  color: var(--muted) !important;
}

.text-primary-fixed,
.text-primary-fixed-dim,
.text-surface-tint,
.text-tertiary-fixed-dim {
  color: var(--primary) !important;
}

.text-secondary {
  color: var(--secondary) !important;
}

.text-error {
  color: var(--danger) !important;
}

.bg-primary-container {
  background: var(--primary) !important;
}

.text-on-primary-container,
.text-on-primary {
  color: var(--primary-text) !important;
}

.bg-tertiary-container\/10,
.bg-tertiary-container\/15,
.bg-tertiary-container\/20 {
  background: color-mix(in srgb, var(--success) 12%, transparent) !important;
}

.bg-error-container\/15,
.bg-error-container\/20,
.bg-error-container\/30 {
  background: color-mix(in srgb, var(--danger) 12%, transparent) !important;
}

.border,
.border-r,
.border-t,
.border-b,
.border-outline-variant,
.border-primary-fixed-dim\/20,
.border-primary-fixed-dim\/30 {
  border-color: var(--border) !important;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  color: var(--field-text) !important;
  background: var(--field-bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
  caret-color: var(--primary);
}

textarea {
  min-height: 140px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--field-placeholder) !important;
  opacity: 1;
  font-weight: 500;
}

select {
  appearance: auto;
}

label,
.uppercase {
  color: var(--muted) !important;
  letter-spacing: 0.04em;
}

button {
  font-weight: 700;
}

button:hover {
  filter: brightness(1.04);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

.theme-toggle .material-symbols-outlined {
  color: var(--primary);
}

.theme-toggle-label {
  font-size: 14px;
  line-height: 20px;
}

:root[data-theme="light"] body {
  background: var(--page);
}

:root[data-theme="light"] aside,
:root[data-theme="light"] header {
  background: rgba(255, 255, 255, 0.92) !important;
}

:root[data-theme="light"] .bg-primary-container {
  color: #ecfeff !important;
}

/* WhatsApp-style chat workspace */
.wa-shell {
  display: grid;
  grid-template-columns: 48px minmax(320px, 360px) minmax(0, 1fr) minmax(280px, 320px);
  height: 100vh;
  min-height: 0;
  background: var(--page);
  color: var(--text);
}

.wa-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.35rem;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
}

.wa-rail-btn,
.wa-icon-btn,
.wa-compose-btn,
.wa-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: var(--muted);
  background: transparent;
}

.wa-rail-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.wa-rail-btn.active,
.wa-rail-btn:hover,
.wa-icon-btn:hover,
.wa-compose-btn:hover {
  background: var(--surface-3);
  color: var(--primary);
}

.wa-sidebar,
.wa-contact-panel,
.wa-chat-panel {
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}

.wa-sidebar,
.wa-chat-panel {
  border-right: 1px solid var(--border);
}

.wa-sidebar {
  display: flex;
  flex-direction: column;
}

.wa-sidebar-header,
.wa-chat-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.wa-sidebar-header h1 {
  margin: 0;
  color: var(--primary);
  font-family: Geist, Inter, sans-serif;
  font-size: 24px;
  line-height: 30px;
  font-weight: 900;
}

.wa-sidebar-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.wa-icon-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.wa-icon-btn,
.wa-compose-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex: 0 0 auto;
}

.wa-search-wrap {
  position: relative;
  margin: 0.75rem 1rem 0.5rem;
}

.wa-search-wrap .material-symbols-outlined {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--subtle);
  pointer-events: none;
}

.wa-search-wrap input {
  min-height: 42px;
  padding-left: 2.75rem;
  border-radius: 999px;
  background: var(--surface-2) !important;
  color: var(--text) !important;
}

.wa-filter-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem 1rem 0.75rem;
  overflow-x: auto;
}

.wa-chip {
  min-height: 34px;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.wa-chip.active {
  background: color-mix(in srgb, var(--success) 18%, var(--surface));
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 35%, var(--border));
}

.wa-notice {
  display: grid;
  grid-template-columns: 36px 1fr 28px;
  gap: 0.75rem;
  align-items: center;
  margin: 0 1rem 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--success) 14%, var(--surface-2));
  color: var(--text);
}

.wa-notice strong,
.wa-notice span {
  display: block;
}

.wa-notice strong {
  font-size: 14px;
}

.wa-notice span {
  color: var(--muted);
  font-size: 12px;
}

.wa-notice button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.wa-list-meta {
  display: flex;
  justify-content: space-between;
  padding: 0 1rem 0.4rem;
  color: var(--subtle);
  font-size: 12px;
}

.wa-conversation-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.wa-conversation {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 0.75rem;
  width: 100%;
  padding: 0.8rem 1rem;
  border: 0;
  border-top: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.wa-conversation:hover,
.wa-conversation.active {
  background: var(--surface-2);
}

.wa-avatar,
.wa-contact-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 16%, var(--surface-3));
  color: var(--primary);
  font-weight: 800;
  flex: 0 0 auto;
}

.wa-avatar {
  width: 42px;
  height: 42px;
}

.wa-contact-avatar {
  width: 86px;
  height: 86px;
  margin: 0 auto 0.75rem;
  font-size: 28px;
}

.wa-conversation-main {
  min-width: 0;
}

.wa-conversation-title,
.wa-conversation-preview,
.wa-conversation-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.wa-conversation-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 15px;
}

.wa-conversation-preview {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 13px;
}

.wa-conversation-preview span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-conversation-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  color: var(--subtle);
  font-size: 11px;
}

.wa-unread-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--success);
  color: #052e16;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 20px;
}

.wa-service-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--danger);
}

.wa-service-dot.open {
  background: var(--success);
}

.wa-chat-panel {
  display: flex;
  flex-direction: column;
}

.wa-chat-header {
  justify-content: flex-start;
}

.wa-chat-title {
  min-width: 0;
  flex: 1;
}

.wa-chat-title h2 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 17px;
  line-height: 23px;
  font-weight: 700;
}

.wa-chat-title p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.wa-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wa-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.wa-status-pill.open {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
  background: color-mix(in srgb, var(--success) 12%, transparent);
}

.wa-status-pill.closed {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.wa-thread {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem min(5vw, 4rem);
  background-color: color-mix(in srgb, var(--surface-2) 75%, var(--page));
  background-image:
    radial-gradient(circle at 20px 20px, color-mix(in srgb, var(--muted) 11%, transparent) 1px, transparent 1px),
    radial-gradient(circle at 70px 60px, color-mix(in srgb, var(--muted) 8%, transparent) 1px, transparent 1px);
  background-size: 92px 92px;
}

.wa-empty-state {
  max-width: 360px;
  margin: 12vh auto;
  text-align: center;
  color: var(--muted);
}

.wa-empty-state .material-symbols-outlined {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.75rem;
  color: var(--primary);
}

.wa-empty-state h3 {
  margin: 0 0 0.35rem;
  color: var(--text);
  font-size: 20px;
}

.wa-day-separator {
  width: fit-content;
  max-width: 80%;
  margin: 0.85rem auto;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  font-size: 12px;
}

.wa-message-row {
  display: flex;
  margin: 0.35rem 0;
}

.wa-message-row.outgoing {
  justify-content: flex-end;
}

.wa-message-bubble {
  max-width: min(680px, 78%);
  padding: 0.45rem 0.65rem 0.35rem;
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.wa-message-row.outgoing .wa-message-bubble {
  background: color-mix(in srgb, var(--success) 18%, var(--surface));
  border-color: color-mix(in srgb, var(--success) 24%, var(--border));
}

.wa-message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 20px;
}

.wa-message-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-top: 0.15rem;
  color: var(--subtle);
  font-size: 11px;
}

.wa-message-ticks {
  display: inline-flex;
  width: auto;
  height: 16px;
  color: var(--subtle);
}

.wa-message-ticks.read {
  color: var(--primary);
}

.wa-message-ticks.failed {
  color: var(--danger);
}

.wa-composer {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.wa-composer textarea {
  min-height: 44px;
  max-height: 132px;
  resize: none;
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  background: var(--field-bg) !important;
  color: var(--field-text) !important;
}

.wa-send-btn {
  width: 48px;
  height: 44px;
  border-radius: 8px;
  color: var(--primary-text);
  background: var(--primary);
}

.wa-send-btn:disabled,
.wa-compose-btn:disabled {
  opacity: 0.45;
}

.wa-composer-status {
  position: absolute;
  left: 8.2rem;
  bottom: 0.1rem;
  margin: 0;
  color: var(--subtle);
  font-size: 11px;
}

.wa-contact-panel {
  padding: 1rem;
  overflow-y: auto;
}

.wa-contact-card {
  padding: 1rem 0 1.25rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.wa-contact-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.wa-contact-card p {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.wa-contact-section {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.wa-contact-section span {
  color: var(--subtle);
  font-size: 12px;
}

.wa-contact-section strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.wa-mobile-only {
  display: none;
}

.wa-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 13, 26, 0.52);
  backdrop-filter: blur(10px);
}

.wa-modal {
  position: fixed;
  z-index: 100;
  top: 7vh;
  left: 50%;
  width: min(92vw, 600px);
  max-height: 86vh;
  overflow-y: auto;
  transform: translateX(-50%);
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.wa-modal-wide {
  width: min(92vw, 720px);
}

.wa-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.wa-modal-header h3 {
  margin: 0;
  color: var(--primary);
  font-family: Geist, Inter, sans-serif;
  font-size: 24px;
  line-height: 32px;
  font-weight: 800;
}

.wa-modal-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 22px;
}

.wa-modal-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.wa-modal-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.wa-modal-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

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

.wa-modal label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted) !important;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.wa-modal input,
.wa-modal select,
.wa-modal textarea {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--border) !important;
  border-radius: 8px;
  background: var(--field-bg) !important;
  color: var(--field-text) !important;
  font-size: 16px;
  font-weight: 500;
}

.wa-modal textarea {
  min-height: 112px;
}

.wa-template-preview {
  min-height: 70px;
  padding: 0.8rem;
  border: 1px solid color-mix(in srgb, var(--success) 22%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--success) 12%, var(--surface-2));
  color: var(--text);
  font-size: 14px;
  line-height: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.wa-modal-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.wa-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.wa-secondary-btn,
.wa-primary-btn {
  min-height: 48px;
  padding: 0.7rem 1.35rem;
  border-radius: 8px;
  font-weight: 800;
}

.wa-secondary-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.wa-primary-btn {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-text);
}

@media (max-width: 1200px) {
  .wa-shell {
    grid-template-columns: 48px minmax(300px, 340px) minmax(0, 1fr);
  }

  .wa-contact-panel {
    display: none;
  }
}

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

  .wa-rail {
    display: none;
  }

  .wa-sidebar,
  .wa-chat-panel {
    grid-column: 1;
    grid-row: 1;
    height: 100vh;
  }

  .wa-chat-panel {
    transform: translateX(100%);
    transition: transform 0.2s ease;
  }

  .wa-shell.chat-open .wa-chat-panel {
    transform: translateX(0);
  }

  .wa-shell.chat-open .wa-sidebar {
    pointer-events: none;
  }

  .wa-mobile-only {
    display: inline-flex;
  }

  .wa-thread {
    padding: 0.75rem;
  }

  .wa-message-bubble {
    max-width: 88%;
  }

  .wa-header-actions .wa-status-pill {
    display: none;
  }

  .wa-modal-grid {
    grid-template-columns: 1fr;
  }

  .wa-modal {
    top: 1rem;
    width: calc(100vw - 2rem);
    padding: 1rem;
  }
}
