:root {
  --surface: #ffffff;
  --surface-muted: #f7f9fb;
  --border: #dfe3e8;
  --border-strong: #c2ccd6;
  --text: #18212f;
  --text-soft: #697586;
  --accent: #25d366;
  --accent-soft: #dcf8e8;
  --incoming: #f5f7fa;
  --shadow: 0 12px 30px rgba(31, 45, 61, 0.08);
  --pipedrive-green: #529e69;
  --pipedrive-green-hover: #62b87c;
  --pipedrive-green-disabled: #bfe0d6;
  --link: #3459e6;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #ffffff;
  color: var(--text);
}

a {
  color: var(--link);
}

code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.95em;
}

.setup-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 1px solid rgba(197, 208, 219, 0.7);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
}

.setup-title {
  font-size: 1.35rem;
  font-weight: 700;
}

.setup-subtitle {
  margin-top: 4px;
  color: var(--text-soft);
}

.setup-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.setup-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: #edf6ff;
  color: #24577a;
  font-size: 0.92rem;
}

.setup-badge-warning {
  background: #fff3db;
  color: #8a5a00;
}

.setup-button {
  text-decoration: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.setup-button:hover {
  transform: translateY(-1px);
}

.setup-button-primary {
  background: #1f7aec;
  color: #fff;
  box-shadow: 0 10px 24px rgba(31, 122, 236, 0.18);
}

.setup-button-secondary {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}

.setup-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px;
  display: grid;
  gap: 20px;
}

.public-home-shell {
  min-height: 100vh;
  align-content: center;
}

.public-home-card {
  max-width: 820px;
  margin: 0 auto;
}

.setup-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(197, 208, 219, 0.65);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.setup-card h1,
.setup-card h2 {
  margin: 0 0 12px;
}

.setup-eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: #4c7c66;
  font-weight: 700;
}

.setup-copy {
  margin: 0 0 22px;
  max-width: 860px;
  color: var(--text-soft);
  line-height: 1.6;
}

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

.setup-grid label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.setup-grid input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fbfdff;
}

.setup-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.setup-stack {
  display: grid;
  gap: 10px;
}

.setup-inline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(217, 225, 232, 0.7);
}

.setup-key {
  color: var(--text-soft);
}

.setup-value {
  font-weight: 700;
}

.setup-warning-box {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid #f3d3a1;
  background: #fffaf2;
  border-radius: 16px;
}

.setup-warning-box ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.panel-body {
  background: #ffffff;
  height: 100%;
  overflow: hidden;
}

.panel-shell {
  height: 100%;
  background: #ffffff;
  overflow: hidden;
}

.panel-status-card,
.panel-empty-card,
.panel-error-card {
  margin: 16px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.panel-status-card p,
.panel-empty-card p,
.panel-error-card p {
  margin: 4px 0 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.panel-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 5px;
  background: var(--pipedrive-green);
}

.panel-app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  background: #ffffff;
  overflow: hidden;
}

.panel-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 16px;
}

.panel-title-block {
  min-width: 0;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.panel-subtitle {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-thread {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  background: #ffffff;
}

.message-row {
  display: flex;
}

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

.message-row-incoming {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 86%;
  border-radius: 18px;
  padding: 10px 12px 8px;
  border: 1px solid rgba(217, 225, 232, 0.75);
}

.message-bubble-incoming {
  background: var(--incoming);
  border-top-left-radius: 8px;
}

.message-bubble-outgoing {
  background: var(--accent-soft);
  border-top-right-radius: 8px;
  border-color: #c8ecd6;
}

.message-author {
  font-size: 0.74rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #57738d;
}

.message-text {
  white-space: pre-wrap;
  line-height: 1.48;
  font-size: 0.95rem;
}

.message-meta {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  color: var(--text-soft);
  font-size: 0.72rem;
}

.panel-composer {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.composer-shell {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.composer-input {
  min-height: 44px;
  max-height: 120px;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: #ffffff;
  resize: none;
  font: inherit;
}

.composer-input::placeholder {
  color: var(--text-soft);
}

.composer-input:focus {
  outline: none;
  border-color: #7aa7ff;
  box-shadow: 0 0 0 3px rgba(52, 89, 230, 0.12);
}

.composer-button {
  min-width: 96px;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  background: var(--pipedrive-green);
  color: white;
  font-weight: 700;
  padding: 0 16px;
  cursor: pointer;
}

.composer-button:hover:not(:disabled) {
  background: var(--pipedrive-green-hover);
}

.composer-button:disabled {
  background: var(--pipedrive-green-disabled);
  cursor: not-allowed;
}

.legal-body {
  min-height: 100%;
  overflow: auto;
  background:
    radial-gradient(circle at top left, rgba(37, 211, 102, 0.12), transparent 28%),
    linear-gradient(180deg, #f7fbf8 0%, #ffffff 32%);
}

.legal-shell {
  min-height: 100%;
  padding: 32px 20px 56px;
}

.legal-frame {
  max-width: 920px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(197, 208, 219, 0.8);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.legal-header {
  padding: 28px 32px 22px;
  border-bottom: 1px solid rgba(217, 225, 232, 0.8);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(12px);
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.legal-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(197, 208, 219, 0.85);
  background: #ffffff;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.legal-nav-link-active {
  background: #edf8f1;
  border-color: rgba(82, 158, 105, 0.4);
  color: #1f5b35;
}

.legal-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: #4c7c66;
  font-weight: 700;
}

.legal-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.05;
}

.legal-lead {
  margin: 16px 0 0;
  max-width: 760px;
  color: var(--text-soft);
  font-size: 1.02rem;
  line-height: 1.7;
}

.legal-warning {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid #f3d3a1;
  background: #fffaf2;
  color: #7a4f00;
}

.legal-content {
  padding: 28px 32px 36px;
}

.legal-section + .legal-section {
  margin-top: 28px;
}

.legal-section h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.legal-section p {
  margin: 0;
  line-height: 1.75;
  color: #314153;
}

.legal-section p + p,
.legal-section ul + p,
.legal-section ol + p {
  margin-top: 12px;
}

.legal-section ul,
.legal-section ol {
  margin: 12px 0 0;
  padding-left: 22px;
  line-height: 1.8;
  color: #314153;
}

.legal-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.legal-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(217, 225, 232, 0.9);
  background: #fbfdfc;
}

.legal-card h3 {
  margin: 0 0 8px;
  font-size: 0.96rem;
}

.legal-card p {
  margin: 0;
  line-height: 1.65;
  color: #425163;
}

.legal-footer {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid rgba(217, 225, 232, 0.8);
  color: var(--text-soft);
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .setup-nav,
  .setup-actions,
  .setup-inline {
    flex-direction: column;
    align-items: flex-start;
  }

  .setup-shell {
    padding: 20px;
  }

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

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

  .composer-button {
    width: 100%;
    min-height: 44px;
  }

  .legal-shell {
    padding: 18px 12px 32px;
  }

  .legal-header,
  .legal-content {
    padding-left: 18px;
    padding-right: 18px;
  }
}
