:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe3ef;
  --blue: #0f766e;
  --blue-2: #ccfbf1;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --shadow: 0 18px 50px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(219, 227, 239, .8);
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 250px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}
.brand span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.nav { display: flex; gap: 8px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: #f8fafc; }
.nav-btn {
  border: 0;
  padding: 9px 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}
.nav-btn.active { background: var(--ink); color: #fff; }
.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  color: #047857;
  background: #ecfdf5;
  font-size: 13px;
}
.status-pill span { width: 8px; height: 8px; border-radius: 999px; background: #22c55e; }

main { width: min(1480px, calc(100vw - 36px)); margin: 24px auto 56px; }
.view { display: none; }
.view.active { display: block; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 390px;
  gap: 28px;
  overflow: hidden;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(15,23,42,.94), rgba(17,94,89,.9) 52%, rgba(68,64,60,.9)),
    url("https://images.unsplash.com/photo-1551288049-bebda4e38f71?auto=format&fit=crop&w=1800&q=80");
  background-size: cover;
  color: #fff;
  padding: 44px;
  box-shadow: var(--shadow);
}
.hero-copy h1 { max-width: 760px; margin: 18px 0 14px; font-size: clamp(34px, 5vw, 60px); line-height: 1.02; letter-spacing: 0; }
.hero-copy p { max-width: 720px; color: rgba(255,255,255,.76); line-height: 1.8; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; color: rgba(255,255,255,.84); font-weight: 700; font-size: 12px; text-transform: uppercase; }
.eyebrow span { width: 8px; height: 8px; border-radius: 999px; background: #bef264; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 640px; margin-top: 28px; }
.metrics div {
  padding: 18px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  background: rgba(255,255,255,.08);
}
.metrics span { display: block; font-size: 30px; font-weight: 800; }
.metrics small { color: rgba(255,255,255,.68); }
.hero-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: center;
  padding: 22px;
  border-radius: 18px;
  background: rgba(255,255,255,.96);
  color: var(--ink);
}
label { color: #334155; font-weight: 700; font-size: 13px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(15,118,110,.14); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.segment { border: 0; border-radius: 10px; padding: 9px; background: transparent; color: var(--muted); }
.segment.active { background: var(--blue); color: #fff; }
.primary-btn, .ghost-btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 15px;
  font-weight: 800;
}
.primary-btn { background: var(--ink); color: #fff; }
.primary-btn:hover { background: #1e293b; }
.ghost-btn { border: 1px solid var(--line); background: #fff; color: #334155; }
.ghost-btn:hover { background: #f8fafc; }

.workspace { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; margin-top: 24px; }
.side-panel, .main-panel, .card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 12px 34px rgba(15,23,42,.05);
}
.side-panel { align-self: start; overflow: hidden; }
.panel-head, .card-head, .table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { white-space: nowrap; }
.panel-head button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 10px;
  background: var(--blue-2);
  color: var(--blue);
  font-weight: 900;
}
.task-list { max-height: 640px; overflow: auto; }
.task {
  padding: 15px 18px;
  border-bottom: 1px solid #eef2f7;
  cursor: pointer;
}
.task.active { background: #f0fdfa; border-left: 3px solid var(--blue); }
.task strong { display: block; margin-bottom: 6px; }
.task small { color: var(--muted); }
.task .badge { margin-top: 10px; }
.main-panel { overflow: hidden; }
.progress-card { margin: 18px 20px 0; padding: 16px; border: 1px solid #99f6e4; border-radius: 14px; background: #f0fdfa; }
.progress-card > div:first-child { display: flex; justify-content: space-between; color: #115e59; }
.progress-track { height: 8px; margin-top: 12px; border-radius: 999px; background: #99f6e4; overflow: hidden; }
#progress-bar { width: 0; height: 100%; background: var(--blue); transition: width .4s ease; }
.hidden { display: none !important; }
.table-toolbar h2, .section-title h1, .card h2 { margin: 0; }
.table-toolbar p, .section-title p { margin: 6px 0 0; color: var(--muted); }
.toolbar-actions { display: flex; gap: 10px; align-items: center; }
.toolbar-actions input { min-width: 220px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 14px 18px; border-bottom: 1px solid #eef2f7; text-align: left; vertical-align: top; }
th { background: #f8fafc; color: #64748b; font-size: 12px; text-transform: uppercase; }
td { font-size: 14px; }
.company-cell strong { display: block; }
.company-cell small { display: block; color: var(--muted); margin-top: 4px; }
.score { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 900; }
.score.high { background: #dcfce7; color: #166534; }
.score.mid { background: #fef3c7; color: #92400e; }
.score.low { background: #fee2e2; color: #991b1b; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.red { background: #fee2e2; color: #991b1b; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 22px; }
.stepper { display: flex; gap: 10px; margin-bottom: 18px; }
.step { border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; background: #fff; color: var(--muted); font-weight: 800; }
.step.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.compose-grid { display: grid; grid-template-columns: minmax(340px, .8fr) minmax(0, 1.2fr); gap: 20px; }
.card { padding-bottom: 18px; overflow: hidden; }
.card > label, .card > input, .card > textarea, .card > .button-row { width: calc(100% - 40px); margin-left: 20px; margin-right: 20px; }
.card > label { display: block; margin-top: 16px; margin-bottom: 8px; }
.recipient-list { padding: 12px 20px; max-height: 540px; overflow: auto; }
.recipient {
  display: flex;
  align-items: start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eef2f7;
}
.recipient strong, .reply strong { display: block; }
.recipient small, .reply small { color: var(--muted); }
.button-row { display: flex; gap: 10px; margin-top: 16px; }
.result-strip { margin-top: 20px; border-radius: 16px; background: #ecfdf5; border: 1px solid #bbf7d0; padding: 16px 18px; color: #065f46; font-weight: 800; }
.analysis-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card { padding: 22px; }
.stat-card strong { display: block; font-size: 36px; }
.stat-card span { color: var(--muted); }
.reply-list { padding: 10px 20px 20px; }
.reply {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid #eef2f7;
}
.reply p { margin: 7px 0 0; color: #334155; line-height: 1.6; }
.reply select { width: 180px; }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  padding: 13px 16px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  box-shadow: var(--shadow);
  transition: .25s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 1100px) {
  .hero, .workspace, .compose-grid { grid-template-columns: 1fr; }
  .side-panel { position: static; }
  .topbar { flex-wrap: wrap; }
  .status-pill { display: none; }
}
@media (max-width: 720px) {
  main { width: calc(100vw - 20px); margin-top: 12px; }
  .hero { padding: 24px; border-radius: 18px; }
  .metrics, .analysis-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 12px; }
  .brand { min-width: auto; }
  .nav { width: 100%; overflow-x: auto; }
  .section-title, .table-toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-actions { flex-direction: column; align-items: stretch; }
  .toolbar-actions input { min-width: 0; }
}
