:root {
  --bg: #f7f1e3;
  --bg-soft: rgba(255, 248, 235, 0.72);
  --panel: rgba(255, 251, 243, 0.92);
  --panel-strong: #fffdf8;
  --text: #1d2f2a;
  --muted: #6f7d74;
  --line: rgba(62, 84, 69, 0.12);
  --brand: #1f8f5f;
  --brand-deep: #166747;
  --accent: #f1b53d;
  --danger: #b53f3f;
  --shadow: 0 28px 90px rgba(29, 47, 42, 0.12);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(241, 181, 61, 0.18), transparent 30%),
    radial-gradient(circle at right, rgba(31, 143, 95, 0.18), transparent 28%),
    linear-gradient(135deg, #f8f0de 0%, #f3efe6 45%, #edf5ee 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.4) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.24;
  pointer-events: none;
}

button,
input {
  font: inherit;
}

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

.shell {
  min-height: 100vh;
  padding: 28px;
  position: relative;
  z-index: 1;
}

.auth-panel,
.app-shell {
  max-width: 1320px;
  margin: 0 auto;
}

.auth-panel {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: center;
}

.brand-lockup {
  padding: 28px;
}

.brand-lockup h1,
.sidebar h2,
.chat-header h2 {
  margin: 0;
  font-size: clamp(2.5rem, 4vw, 4.75rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.auth-copy {
  max-width: 560px;
  margin-top: 18px;
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--muted);
}

.auth-stack,
.sidebar,
.chat-panel,
.auth-card,
.finder-card,
.list-card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.auth-stack {
  border-radius: var(--radius-xl);
  padding: 18px;
  display: grid;
  gap: 16px;
}

.auth-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-button,
.primary-button,
.ghost-button,
.call-button,
.danger-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.mode-button:hover,
.primary-button:hover,
.ghost-button:hover,
.call-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.mode-button {
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  font-weight: 700;
}

.mode-button.active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
}

.auth-card,
.finder-card,
.list-card {
  border-radius: var(--radius-xl);
}

.auth-card,
.finder-card {
  padding: 22px;
  display: grid;
  gap: 16px;
}

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

.field span,
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.field input,
#message-input {
  width: 100%;
  border: 1px solid transparent;
  background: var(--panel-strong);
  color: var(--text);
  padding: 15px 18px;
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 160ms ease, transform 160ms ease;
}

.field input:focus,
#message-input:focus {
  border-color: rgba(31, 143, 95, 0.45);
  transform: translateY(-1px);
}

.primary-button {
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  font-weight: 700;
}

.ghost-button {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

.call-button {
  padding: 13px 18px;
  background: linear-gradient(135deg, #21372f 0%, #355848 100%);
  color: #fff;
  font-weight: 700;
}

.danger-button {
  padding: 12px 16px;
  background: var(--danger);
  color: #fff;
  font-weight: 700;
}

.compact-button {
  padding: 10px 14px;
  font-size: 0.9rem;
}

.helper-text,
.error-text,
.retention-card p,
.typing-indicator,
.sidebar-feedback,
.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.error-text {
  min-height: 24px;
  color: #a43333;
}

.app-shell {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
}

.sidebar {
  border-radius: var(--radius-xl);
  padding: 24px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.sidebar-top,
.chat-header,
.header-actions,
.video-actions,
.call-banner,
.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sidebar-feedback {
  min-height: 24px;
  padding: 0 2px;
}

.list-card,
.retention-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(62, 84, 69, 0.08);
}

.section-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.list-block {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(62, 84, 69, 0.08);
}

.list-row.active {
  border-color: rgba(31, 143, 95, 0.35);
  background: linear-gradient(135deg, rgba(216, 246, 223, 0.9) 0%, rgba(240, 255, 234, 0.9) 100%);
}

.list-row-body {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.list-row-title {
  font-size: 1rem;
}

.list-row-meta {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.list-row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.empty-list-item {
  padding: 10px 2px 2px;
  color: var(--muted);
  line-height: 1.6;
}

.retention-card {
  margin-top: 4px;
}

.chat-panel {
  border-radius: var(--radius-xl);
  padding: 22px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  min-height: 0;
}

.chat-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.chat-header h2 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.presence-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(181, 63, 63, 0.14);
  color: #913333;
  font-size: 0.9rem;
  font-weight: 700;
}

.presence-pill.online {
  background: rgba(31, 143, 95, 0.14);
  color: var(--brand-deep);
}

.call-banner {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: rgba(33, 55, 47, 0.9);
  color: #fff;
}

.call-banner-copy {
  display: grid;
  gap: 4px;
}

.call-banner-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.video-stage {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.7fr);
  gap: 16px;
  align-items: stretch;
}

.video-card {
  min-height: 220px;
  background: #0e1814;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.video-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0e1814;
}

.video-label {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.video-actions {
  grid-column: 1 / -1;
  padding: 0 4px;
}

.empty-state {
  align-self: center;
  justify-self: center;
  max-width: 520px;
  text-align: center;
  padding: 28px;
}

.empty-state h3 {
  margin: 0 0 12px;
  font-size: 1.5rem;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 12px;
  padding: 20px 4px;
}

.message-bubble {
  max-width: min(72%, 520px);
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(62, 84, 69, 0.08);
  box-shadow: 0 18px 32px rgba(29, 47, 42, 0.08);
  display: grid;
  gap: 6px;
}

.message-bubble.outgoing {
  justify-self: end;
  background: linear-gradient(135deg, #d8f6df 0%, #f0ffea 100%);
}

.message-bubble.incoming {
  justify-self: start;
}

.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

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

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

.typing-indicator {
  min-height: 22px;
  padding: 0 2px 10px;
}

.composer-row {
  align-items: stretch;
}

#message-input {
  flex: 1;
}

.hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .shell {
    padding: 18px;
  }

  .auth-panel,
  .app-shell,
  .video-stage {
    grid-template-columns: 1fr;
  }

  .brand-lockup {
    padding: 10px 0 0;
  }

  .chat-panel {
    min-height: calc(100vh - 36px);
  }

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

@media (max-width: 680px) {
  .auth-switcher,
  .sidebar-top,
  .chat-header,
  .header-actions,
  .call-banner,
  .composer-row,
  .video-actions,
  .list-row {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .list-row-actions,
  .call-banner-actions {
    justify-content: stretch;
  }

  .list-row-actions button,
  .call-banner-actions button,
  .header-actions button,
  .composer-row button,
  .sidebar-top button {
    width: 100%;
  }
}
