:root {
  --color-ocean: #002a42;
  --color-forest: #cca34f;
  --color-fejoa: #73bba5;
  --color-manuka: #dfcc8d;
  --color-peach: #dfa092;
  --color-sky: #bfe5fb;
  --color-bg: #f2f7fb;
  --color-surface: #ffffff;
  --color-border: #d6e3ec;
  --color-text: #0a2234;
  --color-muted: #577084;
  --radius-sm: 10px;
  --radius-md: 14px;
  --shadow-card: 0 12px 28px rgba(0, 42, 66, 0.11);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--color-text);
  background:
    radial-gradient(62rem 32rem at -15% -28%, rgba(191, 229, 251, 0.55), transparent 60%),
    radial-gradient(32rem 24rem at 115% -8%, rgba(115, 187, 165, 0.34), transparent 55%),
    var(--color-bg);
}

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

.dashboard-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 2rem 1.25rem;
  background: linear-gradient(168deg, #001b2c 0%, #003454 48%, #0a5679 100%);
  color: #e6f4ff;
  border-right: 1px solid rgba(191, 229, 251, 0.2);
}

.brand-lockup h1 {
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 1.9rem;
  line-height: 1;
  margin: 0.2rem 0 0.5rem;
  color: #ffffff;
}

.brand-overline {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  opacity: 0.75;
}

.brand-copy {
  margin: 0;
  color: #c3e2f5;
  font-size: 0.89rem;
  line-height: 1.4;
}

.dashboard-nav {
  margin-top: 2rem;
  display: grid;
  gap: 0.35rem;
}

.dashboard-nav a {
  color: #d6efff;
  text-decoration: none;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.7rem;
}

.dashboard-nav a:hover,
.dashboard-nav a[aria-current="page"] {
  background: rgba(191, 229, 251, 0.19);
  color: #ffffff;
}

.dashboard-main {
  min-width: 0;
}

.dashboard-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 253, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 2rem;
}

.eyebrow {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.dashboard-header h2 {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 1.55rem;
}

.header-sub {
  margin: 0.45rem 0 0;
  color: var(--color-muted);
  font-size: 0.91rem;
}

.header-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.header-actions label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  font-weight: 700;
}

select,
input[type="number"] {
  height: 2.2rem;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: #fff;
  font-family: inherit;
  padding: 0 0.65rem;
  color: var(--color-text);
}

select:focus-visible,
input[type="number"]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-forest) 72%, white);
  outline-offset: 1px;
}

.btn {
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0.58rem 0.95rem;
  transition: transform 120ms ease, filter 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: saturate(1.05);
}

.btn-primary {
  background: var(--color-fejoa);
  color: #083326;
}

.btn-secondary {
  background: #fff;
  color: var(--color-ocean);
  border-color: var(--color-ocean);
}

.content-wrap {
  padding: 1.5rem 2rem 2.1rem;
  display: grid;
  gap: 1rem;
}

.metric-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.metric-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-card);
}

.metric-label {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.79rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.metric-value {
  margin: 0.42rem 0 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 1.7rem;
}

.panel-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 0.85fr);
}

.lower-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  padding: 0.95rem 1rem 1rem;
  min-width: 0;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.75rem;
}

.card h3 {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 1.12rem;
}

.card p {
  margin: 0.28rem 0 0;
  color: var(--color-muted);
  font-size: 0.88rem;
}

.chip-row {
  display: flex;
  gap: 0.38rem;
  flex-wrap: wrap;
}

.chip {
  border-radius: 999px;
  background: var(--color-sky);
  color: var(--color-ocean);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 800;
  padding: 0.25rem 0.55rem;
}

.flow-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.flow-toolbar label {
  display: grid;
  gap: 0.24rem;
  color: var(--color-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.sankey-wrap {
  min-height: 740px;
  max-height: 78vh;
  border: 1px dashed color-mix(in srgb, var(--color-border) 76%, #fff);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(191, 229, 251, 0.17), transparent 26%),
    #fdfefe;
  overflow: auto;
  position: relative;
  padding: 0.45rem;
}

.sankey-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.vfunnel-svg {
  min-height: 720px;
}

.vfunnel-segment {
  transition: fill-opacity 120ms ease, stroke-width 120ms ease;
}

.vfunnel-label {
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  font-weight: 800;
  fill: #ffffff;
  paint-order: stroke;
  stroke: rgba(7, 36, 53, 0.35);
  stroke-width: 1.5px;
}

.vfunnel-count {
  font-family: "Space Grotesk", "Manrope", sans-serif;
  font-size: 15px;
  font-weight: 700;
  fill: #ffffff;
  paint-order: stroke;
  stroke: rgba(7, 36, 53, 0.35);
  stroke-width: 1.4px;
}

.vfunnel-side {
  font-family: "Manrope", sans-serif;
  font-size: 11px;
  font-weight: 700;
  fill: #4b6a7f;
  letter-spacing: 0.01em;
}

.outcome-funnel-wrap {
  min-height: 620px;
  max-height: 72vh;
  border: 1px dashed color-mix(in srgb, var(--color-border) 76%, #fff);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(191, 229, 251, 0.16), transparent 28%),
    #fdfefe;
  overflow: auto;
  padding: 0.4rem;
}

.outcome-funnel-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.outcome-svg {
  min-height: 600px;
}

.outcome-branch-label {
  font-family: "Manrope", sans-serif;
  font-size: 11px;
  font-weight: 700;
  fill: #ffffff;
  paint-order: stroke;
  stroke: rgba(7, 36, 53, 0.35);
  stroke-width: 1.2px;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 999px;
  padding: 0.23rem 0.56rem;
  font-size: 0.74rem;
  color: #354f62;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.detail-panel {
  display: grid;
  gap: 0.7rem;
}

.detail-title {
  font-weight: 800;
  font-size: 1rem;
}

.detail-sub {
  color: var(--color-muted);
  font-size: 0.83rem;
}

.meta-grid {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-stat {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.56rem 0.65rem;
  background: #fbfdff;
}

.mini-stat .label {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.mini-stat .value {
  margin: 0.34rem 0 0;
  font-size: 1rem;
  font-weight: 800;
}

.mini-stat .mini-sub {
  margin: 0.18rem 0 0;
  color: var(--color-muted);
  font-size: 0.72rem;
}

.section-kicker {
  margin-top: 0.3rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  font-weight: 700;
}

.flow-list,
.path-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.32rem;
}

.flow-list li,
.path-list li {
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 9px;
  padding: 0.42rem 0.5rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.path-list li {
  align-items: flex-start;
}

.comms-list li {
  font-size: 0.78rem;
}

.path-label {
  color: #243f52;
  flex: 1;
}

.path-metrics {
  text-align: right;
  color: #2d4759;
  white-space: nowrap;
}

.duration-grid {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.duration-card {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fbfdff;
  padding: 0.62rem 0.7rem;
}

.duration-card .title {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.duration-card .days {
  margin: 0.35rem 0 0;
  font-size: 1.24rem;
  font-weight: 800;
}

.duration-card .sample {
  margin: 0.15rem 0 0;
  color: var(--color-muted);
  font-size: 0.78rem;
}

.trend-wrap {
  min-height: 288px;
  border: 1px dashed color-mix(in srgb, var(--color-border) 76%, #fff);
  border-radius: 10px;
  overflow: hidden;
  background: #fbfdff;
}

.trend-wrap svg {
  width: 100%;
  height: 100%;
  min-height: 288px;
  display: block;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  text-align: left;
  padding: 0.55rem 0.46rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.86rem;
  vertical-align: top;
}

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

.loading,
.muted {
  color: var(--color-muted);
}

@media (max-width: 1380px) {
  .dashboard-shell {
    grid-template-columns: 214px 1fr;
  }
  .panel-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1060px) {
  .dashboard-shell {
    display: block;
  }

  .dashboard-sidebar {
    position: static;
    height: auto;
    padding: 1rem;
  }

  .dashboard-nav {
    margin-top: 0.9rem;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }

  .dashboard-header {
    position: static;
    padding: 1rem;
  }

  .content-wrap {
    padding: 0.9rem;
  }

  .lower-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sankey-wrap {
    min-height: 620px;
    max-height: none;
  }

  .vfunnel-svg {
    min-height: 620px;
  }

  .outcome-funnel-wrap {
    min-height: 540px;
    max-height: none;
  }

  .outcome-svg {
    min-height: 540px;
  }
}

@media (max-width: 760px) {
  .sankey-wrap {
    min-height: 560px;
    padding: 0.28rem;
  }

  .vfunnel-svg {
    min-height: 560px;
  }

  .vfunnel-label {
    font-size: 10.5px;
  }

  .vfunnel-count {
    font-size: 13px;
  }

  .vfunnel-side {
    display: none;
  }

  .outcome-funnel-wrap {
    min-height: 520px;
    padding: 0.26rem;
  }

  .outcome-svg {
    min-height: 520px;
  }

  .outcome-branch-label {
    font-size: 10px;
  }
}
