:root {
  --ink: #18201d;
  --muted: #66706b;
  --line: #dfe4df;
  --canvas: #f4f6f1;
  --card: #ffffff;
  --dark: #163a2d;
  --dark-2: #0f2b21;
  --lime: #b9ef63;
  --lime-dark: #315f16;
  --amber: #f4b64a;
  --amber-soft: #fff5de;
  --blue: #5d8ee8;
  --blue-soft: #edf3ff;
  --red: #d95a5a;
  --red-soft: #fff0ef;
  --shadow: 0 18px 50px rgba(26, 50, 40, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0%, rgba(185, 239, 99, 0.15), transparent 28rem),
    var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
a { color: inherit; text-decoration: none; }

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

.app-shell { min-height: 100vh; }

.topbar {
  height: 72px;
  padding: 0 max(24px, calc((100vw - 1440px) / 2));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid rgba(24, 32, 29, 0.08);
  background: rgba(244, 246, 241, 0.86);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 780; font-size: 17px; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--dark);
  color: var(--lime);
  font-weight: 850;
}

.topnav { display: flex; gap: 8px; padding: 5px; border-radius: 12px; background: rgba(255,255,255,.7); }
.topnav a { padding: 8px 15px; border-radius: 9px; color: var(--muted); font-weight: 650; }
.topnav a.active { background: var(--card); color: var(--ink); box-shadow: 0 2px 12px rgba(0,0,0,.05); }

.topbar-actions { justify-self: end; display: flex; align-items: center; gap: 12px; }
.ai-launch { min-height: 34px; padding: 0 11px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid #cfe0d3; border-radius: 10px; background: #edf8e8; color: #2b5f28; font-size: 11px; font-weight: 800; }
.ai-launch span { color: #659b2e; font-size: 14px; }
.live-pill { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); font-weight: 650; }
.live-pill span { width: 7px; height: 7px; border-radius: 50%; background: #60b84b; box-shadow: 0 0 0 4px rgba(96,184,75,.12); }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #dbe7dd; font-size: 12px; font-weight: 800; }

main { max-width: 1440px; margin: 0 auto; padding: 50px 24px 70px; }

.hero { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 8px; text-transform: uppercase; letter-spacing: .12em; color: #52745f; font-size: 11px; font-weight: 820; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(34px, 4vw, 54px); line-height: 1.02; letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 24px; letter-spacing: -.025em; }
.hero-copy { margin: 0; color: var(--muted); font-size: 17px; }
.hero-actions { display: flex; gap: 10px; flex-shrink: 0; }

.button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 750;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.button:not(:disabled):hover { transform: translateY(-1px); }
.button-primary { background: var(--dark); color: white; box-shadow: 0 8px 18px rgba(22,58,45,.2); }
.button-primary:hover { background: var(--dark-2); }
.button-primary .button-count { min-width: 23px; height: 23px; padding: 0 7px; display: grid; place-items: center; border-radius: 7px; background: var(--lime); color: var(--dark-2); font-size: 11px; }
.button-secondary { border-color: var(--line); background: var(--card); color: var(--ink); }
.button-ghost { background: transparent; color: var(--muted); }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric-card { min-height: 156px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.84); box-shadow: 0 8px 35px rgba(22,45,35,.035); }
.metric-dark { background: var(--dark); border-color: var(--dark); color: white; }
.metric-heading { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-dark .metric-heading, .metric-dark p { color: #bdcec5; }
.metric-card strong { display: block; margin: 22px 0 6px; font-size: 30px; line-height: 1; letter-spacing: -.04em; }
.metric-card p { margin: 0; color: var(--muted); font-size: 12px; }
.trend { padding: 5px 8px; border-radius: 99px; background: rgba(185,239,99,.13); color: var(--lime); font-size: 10px; }
.metric-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; font-size: 12px; }
.metric-icon.amber { background: var(--amber-soft); color: #a36400; }
.metric-icon.blue { background: var(--blue-soft); color: #3764ba; }
.metric-icon.green { background: #eaf7e7; color: #36752e; }

.workspace { overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,.9); box-shadow: var(--shadow); }
.workspace-heading { padding: 22px 24px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.queue-actions { display: flex; gap: 10px; }
.queue-actions .button { min-height: 38px; font-size: 12px; }
.queue-actions span { min-width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; background: #edf0ec; font-size: 10px; }

.toolbar { padding: 0 24px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.search { width: min(380px, 100%); height: 42px; padding: 0 13px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fafbf8; color: var(--muted); }
.search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search:focus-within { border-color: #90a89a; box-shadow: 0 0 0 3px rgba(95,130,108,.1); }
.filter-tabs { display: flex; gap: 5px; padding: 4px; border-radius: 10px; background: #f0f2ed; overflow-x: auto; }
.filter-tab { padding: 7px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); white-space: nowrap; font-size: 11px; font-weight: 720; }
.filter-tab.active { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.05); }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; min-width: 1040px; border-collapse: collapse; table-layout: fixed; }
th { height: 44px; padding: 0 12px; text-align: left; background: #f9faf7; color: #77807b; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
th:nth-child(2) { width: 24%; }
th:nth-child(3) { width: 9%; }
th:nth-child(4) { width: 12%; }
th:nth-child(5) { width: 16%; }
th:nth-child(6) { width: 10%; }
th:nth-child(7) { width: 20%; }
td { padding: 16px 12px; border-top: 1px solid #edf0eb; vertical-align: middle; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #fbfcf9; }
.check-cell { width: 48px; text-align: center; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--dark); }
.lead-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lead-logo { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; background: var(--logo-bg); color: var(--logo-ink); font-weight: 850; font-size: 12px; }
.lead-cell strong, .lead-cell span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-cell strong { margin-bottom: 4px; font-size: 13px; }
.lead-cell span { color: var(--muted); font-size: 11px; }
.fit-score { display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: 12px; }
.fit-dot { width: 7px; height: 7px; border-radius: 50%; background: #6fbd50; box-shadow: 0 0 0 4px rgba(111,189,80,.1); }
.temperature-select { width: 100%; max-width: 105px; padding: 7px 24px 7px 9px; border: 0; border-radius: 8px; appearance: none; background-repeat: no-repeat; background-position: right 8px center; background-size: 9px; font-size: 11px; font-weight: 780; }
.temperature-select.hot { background-color: var(--red-soft); color: #a63a36; }
.temperature-select.warm { background-color: var(--amber-soft); color: #9a6005; }
.temperature-select.cold { background-color: var(--blue-soft); color: #3d64a7; }
.state-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 8px; font-size: 10px; font-weight: 790; white-space: nowrap; }
.state-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state-needs-approval { background: #f1f2ef; color: #6b736e; }
.state-message-sent { background: var(--blue-soft); color: #466eb7; }
.state-replied { background: var(--amber-soft); color: #96610c; }
.state-call-scheduled { background: #eaf7e7; color: #3a7d32; }
.value { font-weight: 760; font-size: 12px; white-space: nowrap; }
.actions-cell { text-align: right; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.row-action { min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); font-size: 10px; font-weight: 760; white-space: nowrap; }
.row-action.primary { border-color: var(--dark); background: var(--dark); color: white; }
.row-action.complete { background: #eef5ed; color: #3a7335; border-color: #d9e7d7; cursor: default; }

.empty-state { padding: 70px 24px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); }

.activity { margin-top: 22px; padding: 24px; display: grid; grid-template-columns: .8fr 1.2fr; gap: 30px; border-radius: 22px; background: var(--dark); color: white; }
.activity > div > p:last-child { max-width: 420px; margin: 12px 0 0; color: #b9c9c1; line-height: 1.6; }
.activity .eyebrow { color: var(--lime); }
.activity-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.activity-item { padding: 11px 13px; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; border: 1px solid rgba(255,255,255,.1); border-radius: 11px; background: rgba(255,255,255,.055); }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); }
.activity-item strong { display: block; font-size: 11px; }
.activity-item span { color: #aebfb7; font-size: 10px; }
.activity-time { white-space: nowrap; }

.drawer { position: fixed; inset: 0; z-index: 60; pointer-events: none; visibility: hidden; }
.drawer.open { pointer-events: auto; visibility: visible; }
.drawer-backdrop { position: absolute; inset: 0; border: 0; background: rgba(10,22,17,.42); opacity: 0; transition: opacity .22s ease; }
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer-panel { position: absolute; top: 0; right: 0; width: min(590px, 94vw); height: 100%; padding: 30px; display: flex; flex-direction: column; background: #fbfcf9; box-shadow: -20px 0 60px rgba(0,0,0,.16); transform: translateX(100%); transition: transform .24s ease; overflow-y: auto; }
.drawer.open .drawer-panel { transform: translateX(0); }
.drawer-header { display: flex; justify-content: space-between; gap: 20px; align-items: start; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--muted); font-size: 24px; line-height: 1; }
.drawer-lead { margin: 20px 0 14px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.drawer-lead strong { display: block; margin-bottom: 4px; }
.drawer-lead span { color: var(--muted); font-size: 12px; }
.message-body { padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: white; color: #26312c; line-height: 1.72; white-space: pre-wrap; overflow-wrap: anywhere; }
.drawer-actions { margin-top: auto; padding-top: 24px; display: flex; justify-content: flex-end; gap: 10px; }

.ai-drawer .drawer-panel { width: min(470px, 96vw); }
.ai-agent-status { margin: 18px 0 14px; padding: 13px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; border: 1px solid #dbe8d8; border-radius: 13px; background: #f2f9ed; }
.ai-orb { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 11px; background: var(--dark); color: var(--lime); font-size: 15px; }
.ai-agent-status strong, .ai-agent-status small { display: block; }
.ai-agent-status strong { margin-bottom: 3px; font-size: 12px; }
.ai-agent-status small { color: var(--muted); font-size: 10px; }
.agent-live { padding: 5px 7px; border-radius: 7px; background: #dff0d8; color: #397333; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.ai-demo-button { width: 100%; }
.ai-demo-note { margin: 8px 0 17px; color: var(--muted); text-align: center; font-size: 10px; }
.ai-transcript { min-height: 270px; max-height: calc(100vh - 390px); padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; background: #f4f6f1; }
.ai-message { max-width: 88%; padding: 10px 12px; border-radius: 12px; line-height: 1.48; font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-message.ai { align-self: flex-start; border: 1px solid #e0e4df; border-bottom-left-radius: 4px; background: white; color: #34423b; }
.ai-message.user { align-self: flex-end; border-bottom-right-radius: 4px; background: var(--dark); color: white; }
.ai-message.lead { align-self: flex-start; border: 1px solid #efdba9; border-bottom-left-radius: 4px; background: var(--amber-soft); color: #684a12; }
.ai-message.system { align-self: center; max-width: 100%; padding: 6px 9px; background: #e8eee9; color: #66706b; text-align: center; font-size: 9px; font-weight: 750; }
.ai-composer { margin-top: 11px; padding: 5px; display: flex; gap: 7px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.ai-composer input { width: 100%; padding: 8px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 11px; }
.ai-composer button { width: 34px; height: 34px; flex: 0 0 auto; border: 0; border-radius: 9px; background: var(--dark); color: white; font-weight: 850; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 90; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 11px; background: #17251f; color: white; box-shadow: 0 12px 34px rgba(0,0,0,.2); font-size: 12px; font-weight: 650; transform: translate(-50%, 90px); opacity: 0; transition: transform .2s ease, opacity .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 980px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  .filter-tabs { width: 100%; }
  .activity { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .topbar { grid-template-columns: 1fr auto; height: 64px; padding: 0 16px; }
  .topnav { display: none; }
  .live-pill { display: none; }
  .ai-launch { font-size: 0; width: 38px; padding: 0; justify-content: center; }
  .ai-launch span { font-size: 16px; }
  main { padding: 34px 14px 50px; }
  .hero { align-items: stretch; flex-direction: column; }
  .hero-actions { width: 100%; }
  .hero-actions .button { flex: 1; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 132px; padding: 16px; }
  .metric-card strong { margin-top: 17px; font-size: 26px; }
  .metric-card p { line-height: 1.35; }
  .workspace-heading { align-items: stretch; flex-direction: column; padding: 20px 16px 16px; }
  .toolbar { padding: 0 16px 16px; }
  .activity { padding: 20px 16px; }
  .activity-item { grid-template-columns: auto 1fr; }
  .activity-time { display: none; }
  .drawer-panel { width: 100%; padding: 22px 16px; }
  .drawer-actions { flex-direction: column-reverse; }
  .drawer-actions .button { width: 100%; }
}

@media (max-width: 430px) {
  .metrics { grid-template-columns: 1fr; }
  .metric-card { min-height: 120px; }
  .hero-actions { flex-direction: column-reverse; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
