:root {
  --bg: #e8f3f1;
  --bg-deep: #d1e4ea;
  --panel: rgba(249, 253, 252, 0.92);
  --panel-strong: #ffffff;
  --ink: #122330;
  --muted: #5d6d77;
  --border: rgba(18, 35, 48, 0.12);
  --accent: #14857d;
  --accent-deep: #0a5d78;
  --accent-soft: rgba(20, 133, 125, 0.14);
  --sage: #1c7780;
  --gold: #dc9e48;
  --danger: #b64f45;
  --shadow: 0 30px 60px rgba(18, 56, 70, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --body-font: "Avenir Next", "Segoe UI", "Helvetica Neue", "Arial", sans-serif;
  --display-font: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Georgia", serif;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body-font);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 36%),
    radial-gradient(circle at bottom right, rgba(220, 158, 72, 0.16), transparent 30%),
    linear-gradient(160deg, #f3fbfa 0%, var(--bg) 46%, var(--bg-deep) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(25, 77, 97, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 77, 97, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 80%);
}

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

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

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

.page-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.site-header {
  position: sticky;
  top: 1rem;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(248, 253, 252, 0.8);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px rgba(18, 56, 70, 0.08);
}

.brand {
  font-family: var(--display-font);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-mark::before {
  content: "";
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--gold) 100%);
  box-shadow: 0 0 0 0.35rem rgba(20, 133, 125, 0.16);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--muted);
  font-weight: 600;
}

.button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

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

.button {
  color: #f5fffe;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  box-shadow: 0 16px 32px rgba(10, 93, 120, 0.22);
}

.ghost-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.56);
  border-color: var(--border);
}

.danger-button {
  color: #fff7f5;
  background: linear-gradient(135deg, var(--danger) 0%, #8e372f 100%);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 1.5rem;
  align-items: stretch;
  margin-top: 0.75rem;
}

.hero-panel,
.info-panel,
.auth-card,
.summary-card,
.panel,
.lead-card,
.metric-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: rise-in 420ms ease both;
}

.hero-panel {
  padding: 3rem;
}

.hero-panel::after,
.auth-card::after,
.panel::after {
  content: "";
  position: absolute;
  inset: auto -4rem -4rem auto;
  width: 12rem;
  height: 12rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(20, 133, 125, 0.16) 0%, transparent 68%);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(28, 119, 128, 0.12);
  color: var(--sage);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--sage);
}

.hero h1,
.section-title,
.auth-card h1,
.panel h2,
.lead-card h3 {
  margin: 0;
  font-family: var(--display-font);
  letter-spacing: -0.05em;
}

.hero h1 {
  margin-top: 1rem;
  font-size: clamp(2.7rem, 6vw, 4.7rem);
  line-height: 0.96;
}

.hero-copy {
  margin: 1rem 0 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
}

.hero-grid {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

.metric-card {
  padding: 1.35rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(252, 255, 255, 0.92), rgba(239, 248, 248, 0.88));
}

.metric-label,
.muted {
  color: var(--muted);
}

.metric-value {
  margin-top: 0.5rem;
  font-family: var(--display-font);
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.stack {
  display: grid;
  gap: 1rem;
}

.info-panel {
  padding: 1.5rem;
}

.section {
  margin-top: 1.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.section-title {
  font-size: clamp(2rem, 4vw, 3rem);
}

.section-copy {
  color: var(--muted);
  max-width: 42rem;
  line-height: 1.75;
}

.feature-grid,
.summary-grid,
.dashboard-grid {
  display: grid;
  gap: 1rem;
}

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

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

.dashboard-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr);
  align-items: start;
}

.summary-card,
.panel,
.lead-card {
  padding: 1.3rem;
  border-radius: var(--radius-lg);
}

.summary-card strong {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--display-font);
  font-size: 1.9rem;
  letter-spacing: -0.04em;
}

.auth-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 11rem);
}

.auth-card {
  width: min(560px, 100%);
  padding: 2rem;
}

.auth-card h1 {
  font-size: clamp(2.3rem, 5vw, 3.2rem);
}

.auth-card p {
  color: var(--muted);
  line-height: 1.7;
}

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

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

.field label {
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(18, 35, 48, 0.14);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(20, 133, 125, 0.55);
  box-shadow: 0 0 0 0.25rem rgba(20, 133, 125, 0.14);
  background: #fdffff;
}

.field input[readonly] {
  color: var(--muted);
  background: rgba(239, 246, 247, 0.9);
  cursor: default;
}

.field textarea {
  min-height: 8rem;
  resize: vertical;
}

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

.notice {
  margin-bottom: 1rem;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
}

.notice-error {
  background: rgba(182, 79, 69, 0.12);
  color: #7a2c25;
  border: 1px solid rgba(182, 79, 69, 0.18);
}

.notice-success {
  background: rgba(28, 119, 128, 0.14);
  color: #1d5960;
  border: 1px solid rgba(28, 119, 128, 0.22);
}

.app-hero {
  padding: 2rem;
  margin-bottom: 1rem;
}

.app-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  flex-wrap: wrap;
}

.app-heading h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.panel-title {
  font-family: var(--display-font);
  font-size: 1.6rem;
  letter-spacing: -0.04em;
}

.lead-list,
.due-list {
  display: grid;
  gap: 0.9rem;
}

.lead-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.75rem;
}

.lead-company {
  margin-top: 0.25rem;
  color: var(--muted);
}

.lead-notes {
  margin: 0.9rem 0;
  line-height: 1.7;
  color: var(--muted);
}

.lead-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.95rem;
}

.lead-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(18, 35, 48, 0.08);
}

.inline-form {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: center;
}

.inline-form select {
  min-width: 11rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 6.75rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-new {
  background: rgba(220, 158, 72, 0.16);
  color: #8a6719;
}

.status-contacted {
  background: rgba(28, 119, 128, 0.16);
  color: #205961;
}

.status-proposal {
  background: rgba(23, 105, 155, 0.15);
  color: #1f4e75;
}

.status-won {
  background: rgba(41, 148, 117, 0.16);
  color: #1f644c;
}

.status-lost {
  background: rgba(182, 79, 69, 0.14);
  color: #7b2e27;
}

.due-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(252, 255, 255, 0.86), rgba(233, 245, 246, 0.94));
  border: 1px solid rgba(18, 35, 48, 0.08);
}

.due-item strong {
  display: block;
  margin-bottom: 0.25rem;
}

.chat-thread {
  display: grid;
  gap: 0.9rem;
}

.chat-bubble {
  width: min(100%, 46rem);
  padding: 1rem 1.1rem;
  border-radius: 1.2rem;
  border: 1px solid rgba(18, 35, 48, 0.08);
  box-shadow: 0 12px 24px rgba(18, 56, 70, 0.06);
}

.chat-bubble-assistant {
  background: linear-gradient(180deg, rgba(250, 255, 255, 0.95), rgba(235, 246, 247, 0.92));
}

.chat-bubble-user {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(20, 133, 125, 0.12), rgba(10, 93, 120, 0.12));
}

.chat-bubble-pending {
  border-style: dashed;
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.chat-content {
  line-height: 1.75;
  color: var(--ink);
  white-space: normal;
  word-break: break-word;
}

.helper-list {
  display: grid;
  gap: 0.8rem;
}

.helper-list li {
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(18, 35, 48, 0.08);
  line-height: 1.7;
}

.helper-list code,
.empty-state code {
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(18, 35, 48, 0.08);
  font-size: 0.92em;
}

.empty-state {
  padding: 1.4rem;
  border: 1px dashed rgba(18, 35, 48, 0.22);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.38);
}

.list-reset {
  list-style: none;
  padding: 0;
  margin: 0;
}

.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;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

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

@media (max-width: 980px) {
  .hero,
  .dashboard-grid,
  .feature-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .auth-card,
  .panel,
  .summary-card {
    padding: 1.35rem;
  }

  .site-header {
    border-radius: 1.25rem;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100% - 1rem, 100%);
  }

  .site-header,
  .app-heading,
  .lead-head,
  .lead-actions,
  .panel-header,
  .section-header,
  .due-item {
    flex-direction: column;
    align-items: stretch;
  }

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

  .hero h1 {
    font-size: clamp(2.4rem, 12vw, 3.4rem);
  }
}
