:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #141923;
  --muted: #657083;
  --line: #dfe4ec;
  --brand: #0f9f7a;
  --brand-dark: #08735a;
  --soft: #eaf8f3;
  --warning: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 20px 50px rgba(18, 27, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  background: #101722;
  color: white;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  font-weight: 800;
}

.brand span {
  display: block;
  margin-top: 2px;
  color: #aab4c3;
  font-size: 14px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-note {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #cbd5e1;
}

#whatsappStatusDot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--warning);
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
}

h2 {
  font-size: 28px;
  margin-bottom: 10px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 22px;
}

.hero-copy {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 34px;
  box-shadow: var(--shadow);
}

.hero-copy p {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.primary,
.secondary {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 750;
}

.primary {
  background: var(--brand);
  color: white;
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary {
  background: #edf1f7;
  color: var(--ink);
}

.phone-preview {
  background: #13201d;
  border-radius: 8px;
  padding: 18px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}

.phone-header {
  color: white;
  font-weight: 800;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.chat-bubble {
  max-width: 82%;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.4;
}

.inbound {
  background: white;
  align-self: flex-start;
}

.outbound {
  background: #d8f7c8;
  align-self: flex-end;
}

.lead-alert {
  margin-top: auto;
  background: rgba(15, 159, 122, 0.18);
  border: 1px solid rgba(15, 159, 122, 0.5);
  color: #c8ffee;
  border-radius: 8px;
  padding: 12px;
  font-weight: 800;
}

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

.metric-card,
.plans article,
.assistant-rules,
.list-item,
.form-grid {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(18, 27, 40, 0.05);
}

.metric-card {
  padding: 18px;
}

.metric-card span {
  color: var(--muted);
  font-size: 14px;
}

.metric-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 30px;
}

.metric-card p,
.section-header p {
  color: var(--muted);
  margin-bottom: 0;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.switch input {
  display: none;
}

.switch span {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 3px;
  left: 3px;
  border-radius: 999px;
  background: white;
  transition: 0.2s ease;
}

.switch input:checked + span {
  background: var(--brand);
}

.switch input:checked + span::after {
  left: 23px;
}

.section-header {
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 22px;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: white;
}

textarea {
  resize: vertical;
}

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

.template-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.template-panel h3,
.template-panel p {
  margin-bottom: 0;
}

.template-panel p {
  color: var(--muted);
  margin-top: 4px;
}

.alert-header {
  margin-top: 24px;
}

.alert-item {
  border-color: rgba(15, 159, 122, 0.35);
}

.simulator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}

.sim-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.chat-window {
  height: 480px;
  overflow: auto;
  background: #edf7f3;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 10px;
}

.assistant-rules {
  padding: 18px;
}

.assistant-rules li {
  margin-bottom: 10px;
  color: var(--muted);
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  padding: 18px;
}

.list-item-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.badge {
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--soft);
  color: var(--brand-dark);
  font-weight: 800;
  font-size: 12px;
}

.badge.hot {
  background: #fff3d6;
  color: #9a5d00;
}

.item-meta {
  color: var(--muted);
  margin-bottom: 8px;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.small-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
  font-weight: 700;
}

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

.plans article {
  padding: 22px;
}

.plans strong {
  display: block;
  font-size: 30px;
  margin-bottom: 12px;
}

.plans .featured {
  border-color: var(--brand);
  box-shadow: 0 16px 40px rgba(15, 159, 122, 0.14);
}

@media (max-width: 980px) {
  #app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 16px;
  }

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

  .hero,
  .metrics,
  .simulator-layout,
  .plans {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .list-item-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav,
  .form-grid,
  .sim-controls,
  .template-panel {
    grid-template-columns: 1fr;
  }

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

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 24px;
  }
}
