:root {
  --ink: #1f2a33;
  --muted: #50616d;
  --line: #e5eaee;
  --paper: #ffffff;
  --brand: #10477b;
  --brand-dark: #0b355d;
  --secondary: #1f6e8c;
  --accent: #f26b1f;
  --warn: #f26b1f;
  --danger: #b84c12;
  --healthy: #2e8b57;
  --bg-top: #f5f1ea;
  --soft-sand: #f5f1ea;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(31, 110, 140, 0.12), transparent 34%),
    linear-gradient(180deg, var(--bg-top), #ffffff 360px);
  line-height: 1.5;
}

a {
  color: var(--secondary);
  text-decoration: none;
  font-weight: 800;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #ff8a47);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
}

.brand strong,
.brand-sub {
  display: block;
}

.brand-sub {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.85rem;
}

.nav,
.actions,
.filters,
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav form {
  margin: 0;
}

.button,
.nav a,
.nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--brand);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.wrap {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 26px 0 56px;
}

.hero-row,
.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  margin-bottom: 22px;
}

.login-shell {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  min-height: 72vh;
  align-items: center;
}

.eyebrow {
  width: fit-content;
  margin: 0 0 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(242, 107, 31, 0.12);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--brand);
  line-height: 1.08;
}

h1 {
  max-width: 900px;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

h2 {
  font-size: 1.35rem;
}

.lede,
.muted,
.tiny,
.empty {
  color: var(--muted);
}

.lede {
  max-width: 780px;
  margin: 10px 0 0;
  font-size: 1.04rem;
}

.panel,
.metric,
.notice {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 34px rgba(30, 34, 48, 0.06);
}

.panel {
  padding: clamp(18px, 3vw, 26px);
  margin-bottom: 20px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

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

.metric.warn {
  background: linear-gradient(180deg, rgba(242, 107, 31, 0.1), #fff);
}

.metric.danger {
  background: linear-gradient(180deg, rgba(184, 76, 18, 0.08), #fff);
}

.metric.money {
  background: linear-gradient(180deg, rgba(46, 139, 87, 0.1), #fff);
}

.metric-link {
  color: var(--ink);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.metric-link:hover,
.metric-link:focus-visible {
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 20px 38px rgba(16, 71, 123, 0.12);
}

.metric-link small {
  color: var(--secondary);
  font-weight: 900;
}

.funnel-panel .section-head {
  align-items: flex-start;
  justify-content: space-between;
}

.scope-actions .button.active {
  border-color: var(--secondary);
  background: var(--secondary);
  color: #fff;
}

.opportunity-funnel {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 24px;
}

.funnel-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  width: var(--funnel-width);
  min-height: 66px;
  padding: 10px clamp(15px, 3vw, 28px);
  border: 2px solid transparent;
  border-radius: 14px;
  background: linear-gradient(100deg, var(--brand), var(--secondary));
  color: #fff;
  box-shadow: 0 8px 20px rgba(16, 71, 123, 0.12);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.funnel-stage:hover,
.funnel-stage:focus-visible {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(16, 71, 123, 0.2);
}

.funnel-stage.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(242, 107, 31, 0.15);
}

.funnel-stage-closed_won {
  background: linear-gradient(100deg, #226b45, var(--healthy));
}

.funnel-stage-closed_lost {
  background: linear-gradient(100deg, #6b7780, #89949c);
}

.funnel-label,
.funnel-value,
.table-subline,
.stage-direction {
  display: grid;
}

.funnel-label small,
.funnel-value small {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.funnel-value {
  min-width: 90px;
  text-align: right;
}

.funnel-value strong {
  font-size: 1.65rem;
  line-height: 1;
}

.stage-direction {
  max-width: 420px;
  padding: 10px 14px;
  border-left: 4px solid var(--accent);
  background: var(--soft-sand);
}

.stage-direction span,
.table-subline {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.table-subline {
  margin-top: 3px;
}

.stage-pill {
  color: var(--brand);
  background: rgba(31, 110, 140, 0.1);
}

.text-danger,
.text-danger .table-subline {
  color: var(--danger);
}

.filter-summary {
  margin: 16px 0 0;
  padding: 10px 13px;
  border-left: 4px solid var(--accent);
  background: var(--soft-sand);
  color: var(--muted);
  font-weight: 800;
}

.dashboard-controls .filters { justify-content: space-between; }
.scope-label { color: var(--muted); font-weight: 800; }
.executive-metrics .metric small, .manager-summary dt { color: var(--muted); font-weight: 800; }
.attention-count { padding: 8px 12px; border-radius: 999px; color: #fff; background: var(--accent); font-weight: 900; }
.attention-row { background: rgba(242, 107, 31, 0.055); }
.risk-card { display: grid; gap: 6px; padding: 14px; border: 1px solid rgba(242, 107, 31, 0.3); border-left: 5px solid var(--accent); border-radius: 14px; color: var(--ink); background: #fffaf6; }
.risk-card-head { display: flex; justify-content: space-between; gap: 14px; }
.risk-reasons { color: var(--danger); font-size: 0.84rem; font-weight: 900; }
.manager-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.manager-summary div { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft-sand); }
.manager-summary dd { color: var(--brand); font-size: 1.35rem; }
.dashboard-funnel { display: grid; gap: 10px; margin-top: 18px; }
.dashboard-funnel-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(180px, 4fr) 40px minmax(90px, auto); gap: 12px; align-items: center; color: var(--ink); }
.dashboard-funnel-row i { display: block; width: max(4px, var(--bar-width)); height: 18px; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--secondary)); }
.dashboard-funnel-row small { color: var(--muted); text-align: right; font-weight: 800; }
.compact-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quota-input { min-width: 120px; }

.sales-motion {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.motion-step {
  min-width: 120px;
  padding: 16px;
  border-top: 5px solid var(--secondary);
  border-radius: 12px;
  background: var(--soft-sand);
}

.motion-step strong,
.motion-step span {
  display: block;
}

.motion-step span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

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

.guide-list {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: guide;
}

.guide-list li {
  position: relative;
  padding: 13px 13px 13px 50px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfe;
  counter-increment: guide;
}

.guide-list li::before {
  content: counter(guide);
  position: absolute;
  left: 13px;
  top: 13px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

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

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

.lead-card,
.timeline-item,
.callout {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfe;
}

.active-step {
  border-color: rgba(31, 110, 140, 0.35);
  background: linear-gradient(180deg, rgba(31, 110, 140, 0.08), #fbfcfe);
}

.callout.subtle {
  background: #f9f7f2;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field-wide {
  grid-column: 1 / -1;
}

.qualification-gates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft-sand);
}

.field.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field.checkbox input {
  width: 18px;
  height: 18px;
}

.blueprint-track {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.blueprint-step {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 0.8rem;
  font-weight: 900;
}

.blueprint-step.current {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.field span {
  font-size: 0.88rem;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(31, 110, 140, 0.16);
  border-color: var(--secondary);
}

.compact {
  min-width: 180px;
}

.notice {
  margin-bottom: 18px;
  padding: 13px 15px;
  color: var(--brand-dark);
  font-weight: 800;
}

.notice.danger {
  color: var(--danger);
  background: #fff4ed;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 900;
}

.pill.healthy {
  background: rgba(46, 139, 87, 0.12);
  color: var(--healthy);
}

.pill.at-risk {
  background: rgba(242, 107, 31, 0.16);
  color: var(--accent);
}

.pill.stalled {
  background: rgba(184, 76, 18, 0.14);
  color: var(--danger);
}

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

.detail-list div {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

dd {
  margin: 4px 0 0;
  font-weight: 800;
}

.suggestions {
  margin: 0;
  padding-left: 20px;
}

.subsection {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.task-fold {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfe;
}

.task-fold summary {
  padding: 14px 16px;
  cursor: pointer;
  color: var(--brand);
  font-weight: 900;
}

.task-fold[open] summary {
  border-bottom: 1px solid var(--line);
}

.task-fold-list {
  padding: 14px;
}

.activity-edit form {
  padding: 0 14px 14px;
}

.inline-editor {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.inline-editor summary {
  width: fit-content;
  color: var(--secondary);
  font-weight: 900;
  cursor: pointer;
}

.inline-editor form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--soft-sand);
}

.product-card .section-head {
  justify-content: space-between;
}

.readiness-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.readiness-group {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft-sand);
}

.requirement-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.requirement-list li {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: center;
}

.requirement-list li span {
  padding: 3px 7px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 900;
}

.requirement-list .complete span {
  color: var(--healthy);
  background: rgba(46, 139, 87, 0.13);
}

.requirement-list .missing span {
  color: var(--danger);
  background: rgba(242, 107, 31, 0.13);
}

.record-sections {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.record-sections details {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfe;
}

.record-sections summary {
  padding: 15px 18px;
  color: var(--brand);
  font-weight: 900;
  cursor: pointer;
}

.record-sections details[open] summary {
  border-bottom: 1px solid var(--line);
}

.record-sections .detail-list {
  padding: 4px 18px 18px;
}

.stage-detail-form {
  display: grid;
  gap: 16px;
  margin: 0 18px 18px;
  padding: 18px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 14px 14px;
  background: var(--soft-sand);
}

.stage-detail-form > .button {
  justify-self: start;
}

.stage-gate-dialog {
  width: min(560px, calc(100% - 28px));
  max-height: min(720px, calc(100vh - 40px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(16, 71, 123, 0.26);
}

.stage-gate-dialog::backdrop {
  background: rgba(11, 53, 93, 0.56);
  backdrop-filter: blur(4px);
}

.stage-gate-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.dialog-close {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--brand);
  background: var(--soft-sand);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.stage-gate-status {
  width: fit-content;
  margin: 18px 0 12px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
}

.stage-gate-status.incomplete {
  color: var(--danger);
  background: rgba(242, 107, 31, 0.13);
}

.stage-gate-status.ready {
  color: var(--healthy);
  background: rgba(46, 139, 87, 0.13);
}

.stage-gate-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stage-gate-list li {
  padding: 11px 13px 11px 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft-sand);
  position: relative;
  font-weight: 800;
}

.stage-gate-list li::before {
  content: "!";
  position: absolute;
  left: 13px;
  color: var(--accent);
  font-weight: 900;
}

.stage-gate-actions {
  justify-content: flex-end;
  margin-top: 22px;
}

@media (max-width: 900px) {
  .metrics,
  .dashboard-grid,
  .detail-grid,
  .hero-row,
  .login-shell,
  .fields,
  .qualification-gates {
    grid-template-columns: 1fr;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 680px) {
  .funnel-stage {
    width: 100%;
  }

  .funnel-label small {
    display: none;
  }

  .dashboard-funnel-row { grid-template-columns: minmax(110px, 1fr) minmax(100px, 2fr) 32px; }
  .dashboard-funnel-row small { display: none; }
}
