:root {
  --blue: #1469c7;
  --blue-dark: #0b3f78;
  --green: #8ef58d;
  --ink: #132033;
  --muted: #6b7686;
  --line: #dce3ed;
  --surface: #ffffff;
  --soft-blue: #eef6ff;
  --soft-green: #efffec;
  --gold: #f4b84d;
  --rose: #fff7ef;
  --shadow: 0 16px 50px rgba(19, 32, 51, 0.09);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #f5f7fa;
}

body.locked {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 284px 1fr;
  min-height: 100vh;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(130deg, rgba(245, 247, 250, 0.96), rgba(238, 246, 255, 0.98)),
    radial-gradient(circle at top right, rgba(142, 245, 141, 0.26), transparent 34%);
}

.login-gate.hidden {
  display: none;
}

.login-panel {
  width: min(430px, 100%);
  padding: 28px;
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.login-panel img {
  width: 220px;
  max-width: 100%;
}

.login-panel h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.login-panel p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-panel label {
  display: grid;
  gap: 8px;
  color: var(--blue-dark);
  font-weight: 850;
}

.login-panel input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

.login-error {
  min-height: 20px;
  margin: -6px 0 0;
  color: #b42318;
  font-weight: 800;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand img {
  width: 210px;
  max-width: 100%;
  display: block;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  color: var(--blue-dark);
  background: var(--soft-blue);
}

.nav-icon {
  width: 22px;
  text-align: center;
  color: var(--blue);
}

.sidebar-panel {
  margin-top: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--soft-blue), var(--soft-green));
  display: grid;
  gap: 8px;
}

.sidebar-panel strong {
  font-size: 1.05rem;
}

.sidebar-panel span,
.muted,
.metric small {
  color: var(--muted);
}

.main {
  padding: 28px;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 28px;
}

.topbar h1,
.section-title h2,
.hero-lead h2,
.agents-layout h2,
.settings-layout h2,
.dialog-head h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.7rem, 2.2vw, 2.6rem);
  line-height: 1.08;
}

.topbar-actions,
.lead-actions,
.section-title.inline {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.segment {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
}

.primary-button {
  padding: 0 16px;
  color: white;
  background: var(--blue);
  box-shadow: 0 8px 22px rgba(20, 105, 199, 0.22);
}

.secondary-button,
.ghost-button {
  padding: 0 14px;
  color: var(--blue-dark);
  background: white;
  border-color: var(--line);
}

.ghost-button {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.75);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.hero-lead,
.news-panel,
.pipeline-section,
.agents-layout,
.settings-layout,
.prospect-table,
.lead-dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 116px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  border-top: 4px solid var(--blue);
}

.metric strong {
  font-size: 2rem;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-weight: 700;
}

.metric.accent-green {
  border-top-color: #32ba5c;
}

.metric.accent-gold {
  border-top-color: var(--gold);
}

.metric.accent-ink {
  border-top-color: var(--ink);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
  margin-bottom: 18px;
}

.hero-lead {
  min-height: 290px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(120deg, rgba(20, 105, 199, 0.95), rgba(11, 63, 120, 0.92)),
    url("./assets/logo-updistry.png");
  background-repeat: no-repeat;
  background-size: cover, 520px auto;
  background-position: center, right -180px bottom -60px;
  color: white;
}

.hero-lead .eyebrow,
.hero-lead .lead-summary {
  color: rgba(255, 255, 255, 0.84);
}

.hero-lead h2 {
  font-size: clamp(1.9rem, 3vw, 3rem);
}

.hero-lead-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.score {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--blue-dark);
  background: var(--green);
  font-size: 1.25rem;
  font-weight: 900;
}

.lead-summary {
  max-width: 760px;
  font-size: 1.05rem;
  line-height: 1.6;
}

.news-panel,
.pipeline-section,
.agents-layout,
.settings-layout {
  padding: 22px;
}

.section-title {
  margin-bottom: 18px;
}

.section-title.inline {
  justify-content: space-between;
}

.news-list,
.agent-list {
  display: grid;
  gap: 12px;
}

.news-item,
.agent-card,
.prospect-row,
.lead-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.news-item {
  padding: 14px;
}

.news-item strong,
.lead-card strong,
.prospect-row strong {
  display: block;
  margin-bottom: 5px;
}

.news-item p,
.lead-card p,
.prospect-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.segmented {
  display: flex;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.segment {
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.segment.active {
  color: var(--blue-dark);
  background: white;
  border-color: var(--line);
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.stage {
  min-width: 220px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.stage h3 {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #f1f5f9;
  font-size: 0.95rem;
}

.lead-card {
  padding: 14px;
}

.lead-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--blue-dark);
  font-size: 0.75rem;
  font-weight: 800;
}

.pill.green {
  background: var(--soft-green);
  color: #12713a;
}

.pill.gold {
  background: #fff5da;
  color: #855600;
}

.small-link {
  border: 0;
  padding: 0;
  color: var(--blue);
  background: transparent;
  font-weight: 900;
}

.prospect-table {
  overflow: hidden;
}

.prospect-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr 0.8fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-width: 0 0 1px;
  border-radius: 0;
}

.prospect-row:last-child {
  border-bottom: 0;
}

.search-input,
.settings-form input,
.settings-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.search-input {
  max-width: 360px;
  min-height: 42px;
  padding: 0 12px;
}

.agents-layout,
.settings-layout {
  display: grid;
  grid-template-columns: minmax(230px, 0.55fr) minmax(320px, 1fr);
  gap: 24px;
}

.agent-card {
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  border: 0;
  background: #cbd5e1;
}

.toggle::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: white;
  transition: transform 0.18s ease;
}

.toggle.active {
  background: var(--blue);
}

.toggle.active::after {
  transform: translateX(20px);
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-form label {
  display: grid;
  gap: 8px;
  color: var(--blue-dark);
  font-weight: 850;
}

.settings-form input,
.settings-form textarea {
  padding: 12px;
  color: var(--ink);
  font-weight: 500;
}

.settings-form textarea {
  min-height: 104px;
  resize: vertical;
}

.lead-dialog {
  width: min(720px, calc(100vw - 28px));
  padding: 0;
}

.lead-dialog::backdrop {
  background: rgba(19, 32, 51, 0.42);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 12px;
}

.icon-button {
  width: 40px;
  padding: 0;
  color: var(--ink);
  background: white;
  border-color: var(--line);
  font-size: 1.5rem;
}

#dialogContent {
  padding: 0 22px 22px;
  display: grid;
  gap: 14px;
}

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

.info-box {
  padding: 14px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.info-box span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 4px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .sidebar-panel {
    display: none;
  }

  .metrics-grid,
  .dashboard-grid,
  .agents-layout,
  .settings-layout {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .main,
  .sidebar {
    padding: 18px;
  }

  .nav-list,
  .metrics-grid,
  .dashboard-grid,
  .agents-layout,
  .settings-layout,
  .dialog-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .hero-lead-header,
  .prospect-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .brand img {
    width: 170px;
  }

  .topbar-actions,
  .topbar-actions button,
  .lead-actions button,
  .search-input {
    width: 100%;
  }

  .hero-lead {
    padding: 22px;
    background-size: cover, 320px auto;
  }

  .prospect-row {
    gap: 8px;
  }
}
