:root {
  color-scheme: light;
  --ink: #101828;
  --muted: #667085;
  --line: #d8e1e7;
  --panel: #ffffff;
  --paper: #f3f6f8;
  --accent: #0f766e;
  --accent-2: #c28a2e;
  --accent-3: #344054;
  --sidebar: #101820;
  --good: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --shadow: 0 18px 45px rgba(16, 24, 40, 0.09);
  --shadow-soft: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-strong: 0 28px 80px rgba(16, 24, 40, 0.14);
  --gold: #f1b856;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.09) 0 18%, transparent 18% 100%),
    linear-gradient(180deg, #ffffff 0, #f6fbfb 340px, #eef4f6 680px),
    var(--paper);
}

a { color: inherit; }

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

.sidebar {
  padding: 26px 22px;
  background:
    linear-gradient(180deg, #101820 0%, #0c151a 100%);
  color: #f7faf8;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 38px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: block;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.brand strong {
  display: block;
  font-size: 1.06rem;
}

.brand small,
.eyebrow,
.row-card span,
.timeline small {
  color: var(--muted);
  font-size: 0.78rem;
}

.sidebar .brand small { color: #a9b7bf; display: block; }

nav {
  display: grid;
  gap: 6px;
}

nav a {
  text-decoration: none;
  color: #d8e2e6;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 700;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(2px);
}

main {
  padding: 24px 34px 42px;
  display: grid;
  gap: 20px;
  max-width: 1760px;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 4px 0 0;
}

.breadcrumb {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 780px;
  font-size: clamp(2rem, 2.65vw, 3.05rem);
  margin-bottom: 12px;
  line-height: 1.04;
}
h2 { font-size: 1.18rem; margin-bottom: 0; }
h3 { font-size: 1rem; margin-bottom: 7px; }
p { color: var(--muted); line-height: 1.6; }

.header-copy {
  max-width: 620px;
  margin-bottom: 0;
  font-size: 1rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
  margin-bottom: 8px;
}

.status-pill,
.severity {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: #fff;
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
}

.command-center {
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(420px, 0.72fr);
  gap: 22px;
  align-items: stretch;
}

.hero-panel,
.activity-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-strong);
  min-width: 0;
}

.hero-panel {
  padding: 28px;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
  overflow: hidden;
  position: relative;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 6px solid var(--accent);
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.08), transparent 38%),
    linear-gradient(300deg, rgba(241, 184, 86, 0.16), transparent 34%);
  pointer-events: none;
}

.hero-copy,
.metric-grid {
  position: relative;
  z-index: 1;
}

.hero-visual {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 8px 0;
}

.hero-visual img {
  width: 134px;
  height: 134px;
  border-radius: 24px;
  box-shadow: 0 22px 54px rgba(16, 24, 40, 0.2);
}

.hero-visual div {
  display: grid;
  gap: 8px;
  width: 100%;
}

.hero-visual span {
  display: block;
  padding: 8px 10px;
  border: 1px solid #dce8e8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.metric-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
}

.metric-grid article,
.panel,
.row-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-grid article {
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
  border-top: 3px solid #f1b856;
}

.metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.metric-grid strong {
  display: block;
  font-size: 2rem;
  margin-top: 8px;
  line-height: 1;
}

.activity-panel {
  padding: 20px;
  min-height: 420px;
}

.activity-head {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.tab-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  background: #edf3f3;
  border-radius: 8px;
}

.tab-button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--accent-3);
  box-shadow: none;
  padding: 9px 10px;
}

.tab-button:hover,
.tab-button.active {
  background: #ffffff;
  color: var(--accent);
}

.tab-button span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #dcebea;
  color: var(--accent);
  font-size: 0.76rem;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.table-wrap {
  width: 100%;
  max-height: 315px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.86rem;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7faf9;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f3;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.73rem;
  text-transform: uppercase;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

tbody tr:last-child td { border-bottom: 0; }

.status-chip {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef4f3;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
}

.status-chip.qualified {
  background: #eaf7ef;
  color: var(--good);
}

.workspace,
.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.panel {
  padding: 24px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #edf1f3;
}

.panel-agent-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.16);
}

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

.span-2 { grid-column: span 2; }

label {
  display: grid;
  gap: 8px;
  color: var(--accent-3);
  font-size: 0.84rem;
  font-weight: 700;
}

label.inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.business-picker { align-content: start; }

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  font: inherit;
  background: #fcfdfd;
  box-shadow: inset 0 1px 0 rgba(17, 24, 39, 0.02);
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(17, 126, 114, 0.6);
  box-shadow: 0 0 0 3px rgba(17, 126, 114, 0.12);
  outline: none;
}

textarea { min-height: 96px; resize: vertical; }

button,
.button-link {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

button:hover,
.button-link:hover { background: #0d6e64; }

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

button.ghost {
  background: #eef4f3;
  color: var(--accent);
}

.refresh-action {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 13px;
  background: #f7fbfa;
  color: var(--accent);
  border: 1px solid #cfe0df;
  white-space: nowrap;
}

.refresh-action span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #dcebea;
  font-size: 1rem;
}

.list,
.timeline {
  display: grid;
  gap: 12px;
}

.row-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px;
}

.row-card p { margin-bottom: 6px; }

.severity {
  display: inline-block;
  padding: 4px 9px;
  margin-bottom: 8px;
  font-size: 0.72rem;
}

.severity.high { color: var(--bad); }
.severity.medium { color: var(--warn); }
.severity.low { color: var(--good); }

.empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #172026;
  color: white;
  padding: 13px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(8, 16, 22, 0.66), rgba(15, 118, 110, 0.34)),
    rgba(8, 16, 22, 0.42);
  backdrop-filter: blur(8px);
}

.processing-overlay[hidden] {
  display: none;
}

.processing-card {
  width: min(520px, 100%);
  display: grid;
  justify-items: center;
  gap: 15px;
  padding: 34px;
  border: 1px solid rgba(216, 225, 231, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 250, 0.98));
  box-shadow: var(--shadow-strong);
  text-align: center;
}

.processing-card strong {
  font-size: 1.35rem;
}

.processing-card p {
  margin-bottom: 0;
  max-width: 390px;
}

.agent-loader {
  position: relative;
  width: 148px;
  height: 148px;
  display: grid;
  place-items: center;
}

.agent-loader::before,
.agent-loader::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 999px;
  border: 2px solid rgba(15, 118, 110, 0.18);
}

.agent-loader::after {
  inset: 0;
  border-top-color: var(--gold);
  border-right-color: var(--accent);
  animation: spin 1.15s linear infinite;
}

.agent-loader img {
  width: 82px;
  height: 82px;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(16, 24, 40, 0.22);
  animation: pulse 1.6s ease-in-out infinite;
}

.signal {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 0 8px rgba(241, 184, 86, 0.16);
}

.signal-a { top: 16px; left: 34px; }
.signal-b { right: 18px; top: 62px; background: var(--accent); box-shadow: 0 0 0 8px rgba(15, 118, 110, 0.16); }
.signal-c { bottom: 18px; left: 60px; background: #ffffff; border: 3px solid var(--accent); }

.processing-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.processing-steps span {
  padding: 8px 9px;
  border-radius: 8px;
  background: #eef6f5;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  animation: stepPulse 1.6s ease-in-out infinite;
}

.processing-steps span:nth-child(2) { animation-delay: 160ms; }
.processing-steps span:nth-child(3) { animation-delay: 320ms; }
.processing-steps span:nth-child(4) { animation-delay: 480ms; }

.is-processing button,
.is-processing input,
.is-processing textarea,
.is-processing select {
  pointer-events: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes stepPulse {
  0%, 100% { background: #eef6f5; color: var(--accent); }
  50% { background: var(--accent); color: #ffffff; }
}

.public-page {
  color: var(--public-text, var(--ink));
  background:
    radial-gradient(circle at 78% 8%, color-mix(in srgb, var(--public-accent, var(--accent)) 8%, transparent), transparent 24rem),
    var(--public-bg, #f7f5ef);
}

.public-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 28px 42px;
}

.public-brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--public-line, var(--line));
}

.brand-home {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--public-primary, var(--accent));
  font-weight: 800;
  text-decoration: none;
}

.brand-logo {
  display: block;
  max-width: 190px;
  max-height: 48px;
  object-fit: contain;
}

.brand-name {
  font-size: 1.05rem;
}

.public-page .eyebrow {
  color: var(--public-accent, var(--accent));
  letter-spacing: 0.08em;
}

.public-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 380px;
  gap: 34px;
  align-items: start;
  padding: 64px 0 56px;
}

.public-hero h1 {
  max-width: 820px;
  color: var(--public-text, var(--ink));
}

.public-hero p {
  color: var(--public-muted, var(--muted));
}

.lead-form {
  background: var(--public-surface, white);
  border: 1px solid var(--public-line, var(--line));
  border-top: 5px solid var(--public-accent, var(--accent));
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 24px 70px color-mix(in srgb, var(--public-primary, #101828) 12%, transparent);
  display: grid;
  gap: 12px;
}

.lead-form h2 {
  margin-bottom: 4px;
  color: var(--public-text, var(--ink));
}

.lead-form button {
  background: var(--public-accent, var(--accent));
  color: var(--public-button-text, white);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--public-accent, var(--accent)) 24%, transparent);
}

.lead-form button:hover {
  background: var(--public-accent-dark, var(--accent));
}

.public-sections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.public-sections section {
  background: var(--public-surface, white);
  border: 1px solid var(--public-line, var(--line));
  border-top: 4px solid var(--public-accent, var(--accent));
  border-radius: 8px;
  padding: 22px;
}

.public-sections h2 {
  color: var(--public-text, var(--ink));
}

.public-sections p {
  color: var(--public-muted, var(--muted));
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .command-center { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workspace, .two-column, .public-hero, .public-sections { grid-template-columns: 1fr; }
  .hero-panel { grid-template-columns: 1fr; }
  .hero-visual { justify-items: start; }
  .hero-visual div { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1440px) {
  .command-center {
    grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    justify-items: start;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
  }

  .hero-visual img {
    width: 92px;
    height: 92px;
    border-radius: 18px;
  }

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

@media (max-width: 980px) {
  .command-center,
  .workspace,
  .two-column,
  .public-hero,
  .public-sections {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  main, .public-shell { padding: 18px; }
  .topbar, .row-card { align-items: stretch; flex-direction: column; }
  .metric-grid, .grid-form { grid-template-columns: 1fr; }
  .command-center { gap: 16px; }
  .hero-panel, .activity-panel, .panel { padding: 18px; }
  .table-wrap { max-height: 360px; }
  .tab-switcher { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .public-hero { padding: 26px 0; }
  .panel-head { flex-direction: column; }
  .refresh-action { width: 100%; justify-content: center; }
  .processing-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
