/* Task-oriented workspace, layered over the existing chart, globe, and journey components. */
:root {
  --ink: #27292f;
  --muted: #73757e;
  --border: #e5e5e1;
  --surface: #ffffff;
  --background: #f7f7f5;
  --accent: #33363e;
  --sidebar: #fcfcfb;
  --sidebar-text: #666972;
  --sidebar-muted: #9698a0;
  --soft-surface: #f2f2ef;
  --hover-surface: #eeefec;
  --selected-surface: #eaece8;
  --selected-ink: #24272d;
  --panel-shadow: 0 2px 8px #24242404;
  --app-header-height: 0px;
  --header-offset: 100px;
  --chart-height: 240px;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 100;
  padding: 12px;
  color: var(--ink);
  background: var(--surface);
}

.skip-link:focus {
  top: 10px;
}

.app {
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
}

.app-header {
  position: sticky;
  top: 0;
  height: 100dvh;
  border: 0;
  border-right: 1px solid var(--border);
  color: var(--sidebar-text);
  background: var(--sidebar);
}

.app-header::after,
.filters::before {
  display: none;
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: stretch;
  height: 100%;
  min-height: 0;
  padding: 30px 18px 22px;
  overflow-y: auto;
}

.app-header .brand {
  gap: 12px;
  padding: 0 8px 22px;
}

.app-header .brand-label {
  font-size: 1.125rem;
  color: var(--ink);
}

.site-label {
  margin: 0 6px 24px;
  padding: 14px 0;
  border-top: 1px solid #33505d;
  border-bottom: 1px solid #33505d;
  font-size: .875rem;
  font-weight: 500;
}

.site-label span {
  display: block;
  margin-top: 5px;
  font-size: .75rem;
  font-weight: 400;
  color: var(--sidebar-muted);
}

.primary-nav {
  display: flex;
  flex: 0;
  flex-direction: column;
  gap: 5px;
  align-items: stretch;
  justify-content: start;
}

.nav-label {
  margin: 18px 10px 8px;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .065em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}

.nav-label:first-child {
  margin-top: 0;
}

.nav-item {
  gap: 10px;
  min-height: 42px;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  font-size: .8125rem;
  color: var(--sidebar-text);
}

.nav-item span {
  width: 20px;
  font-size: 1.25rem;
  text-align: center;
  color: var(--sidebar-muted);
}

.nav-item:hover,
.nav-item.selected {
  color: var(--selected-ink);
  background: var(--selected-surface);
}

.nav-item.selected span {
  color: var(--ink);
}

.sidebar-bottom {
  margin-top: auto;
  padding: 28px 8px 0;
}

.sidebar-bottom p {
  margin: 14px 0;
  font-size: .75rem;
  line-height: 1.6;
  color: var(--sidebar-muted);
}

.header-inner .demo-banner {
  display: inline-block;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--soft-surface);
}

.logout {
  width: 100%;
  margin: 0;
  color: var(--sidebar-text);
  background: transparent;
}

main {
  width: 100%;
  max-width: 1600px;
  min-width: 0;
  margin: 0 auto;
  padding: 32px clamp(20px, 3vw, 48px) 24px;
}

.topbar {
  gap: 22px;
  align-items: start;
  margin-bottom: 22px;
}

.topbar .eyebrow {
  margin-bottom: 10px;
  font-size: .6875rem;
  letter-spacing: .09em;
}

h1 {
  font-size: 1.875rem;
  letter-spacing: -.04em;
}

.view-description {
  max-width: 760px;
  margin-top: 8px;
  font-size: .875rem;
  line-height: 1.6;
  color: var(--muted);
}

.live-status {
  flex-shrink: 0;
  margin-top: 4px;
  font-size: .75rem;
}

.filters {
  top: 0;
  gap: 14px 22px;
  margin: 0 0 28px;
  padding: 14px 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--background);
  box-shadow: none;
}

.filter-group {
  gap: 10px;
}

.comparison-label {
  margin-left: auto;
  font-size: .75rem;
  color: var(--muted);
}

.range-label {
  width: 100%;
  margin: 0;
  font-size: .75rem;
}

.metrics {
  gap: 14px;
  margin-bottom: 24px;
}

.metric-group {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--panel-shadow);
}

.metric-group-outcomes {
  border-top: 1px solid var(--border);
}

.metric-group-outcomes .metric-secondary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-group-label {
  font-size: .6875rem;
  letter-spacing: .07em;
}

.metric-primary .metric-value {
  font-size: 2.25rem;
}

.metric-description {
  font-size: .8125rem;
}

.section-heading {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-heading .eyebrow {
  margin-bottom: 5px;
  font-size: .6875rem;
}

.section-heading h2 {
  font-size: 1.125rem;
}

.section-heading .muted {
  font-size: .75rem;
}

.insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
  padding: 20px 22px;
  border: 1px solid #c8dfe4;
  border-radius: 8px;
  background: #edf6f7;
}

.insight {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.insight + .insight {
  padding-left: 20px;
  border-left: 1px solid #c8dfe4;
}

.insight h3 {
  font-size: .9375rem;
  line-height: 1.4;
}

.insight p {
  font-size: .8125rem;
  line-height: 1.65;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.insight a {
  margin-top: auto;
  padding-top: 4px;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--accent);
}

.overview-analysis {
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(240px, 1fr);
  gap: 18px;
}

.trend-slot {
  min-width: 0;
}

.card,
.trend-card {
  border-radius: 8px;
  box-shadow: none;
}

.trend-card {
  margin: 0;
}

.trend-card .card-heading h2 {
  font-size: 1rem;
}

.trend-card .card-heading {
  flex-wrap: wrap;
  gap: 12px;
}

.trend-card .chart-hint {
  display: none;
}

.next-steps {
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.next-steps h2 {
  margin: 8px 0 10px;
  font-size: 1.125rem;
}

.next-steps > a {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  font-size: .8125rem;
  line-height: 1.5;
}

.next-steps strong {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--accent);
}

.next-steps strong span {
  float: right;
}

.next-steps a > span {
  color: var(--muted);
}

.next-steps > p:last-child {
  margin-top: 20px;
  font-size: .75rem;
}

.overview-context {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: start;
  margin: 18px 0 0;
  padding: 0;
  background: transparent;
}

.overview-context .comparison-note,
.overview-context summary,
.text-link {
  font-size: .8125rem;
}

.text-link {
  color: var(--accent);
}

.reports {
  margin: 0;
}

.report-heading {
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 24px;
}

.tabs {
  flex-wrap: wrap;
  gap: 4px;
}

.tabs button {
  padding: 9px 12px;
  border: 0;
  border-radius: 5px;
  font-size: .8125rem;
}

.tabs button[aria-selected="true"] {
  color: var(--accent);
  background: var(--uid-blue-wash);
}

.report-note {
  padding: 18px 24px 0;
}

.explorer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  padding: 18px 24px;
}

.explorer-controls label {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: .75rem;
  color: var(--muted);
}

.explorer-controls input,
.explorer-controls select {
  font-size: .8125rem;
}

.explorer-controls .search-label {
  flex: 1;
  min-width: 200px;
}

.explorer-controls .search-label input {
  width: 100%;
}

.report-context {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  padding: 0 24px 18px;
  font-size: .75rem;
  color: var(--muted);
}

.report-context #report-baseline {
  font-weight: 500;
  color: var(--ink);
}

.reports .table-wrap {
  border-top: 1px solid var(--border);
}

.reports table {
  width: 100%;
  font-size: .8125rem;
}

.reports th {
  padding: 10px 16px;
  font-weight: 500;
  color: var(--muted);
  background: #f7f9fa;
}

.reports td {
  padding: 16px;
}

.reports th:first-child,
.reports td:first-child {
  padding-left: 24px;
}

.reports tbody tr:hover {
  background: #f8fbfc;
}

.reports tbody tr.selected-row {
  background: #edf6f7;
}

.sort-button {
  padding: 0;
  border: 0;
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
  color: inherit;
  background: transparent;
}

.sort-button:hover {
  color: var(--accent);
  background: transparent;
}

.reports td small {
  display: block;
  margin-top: 5px;
  font-size: .6875rem;
  color: var(--muted);
}

.path-cell {
  max-width: 360px;
  overflow-wrap: anywhere;
}

.comparison-cell {
  width: 50px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.recorded-fields {
  margin: 16px 0;
  font-size: .75rem;
  line-height: 1.6;
}

.recorded-fields summary {
  color: var(--accent);
}

.recorded-fields dl {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.recorded-fields dt {
  font-weight: 500;
  color: var(--muted);
}

.recorded-fields dd {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.comparison-cell input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.evidence-cue {
  font-size: .75rem;
  line-height: 1.4;
  color: var(--muted);
}

.rate-difference {
  white-space: nowrap;
}

.comparison-panel {
  margin: 0 24px 20px;
  padding: 18px;
  border: 1px solid #c8dfe4;
  border-radius: 6px;
  background: #edf6f7;
}

.comparison-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.comparison-heading h3 {
  font-size: .9375rem;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.comparison-grid strong {
  display: block;
  font-size: .875rem;
  overflow-wrap: anywhere;
}

.comparison-grid dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  margin: 14px 0;
  font-size: .8125rem;
}

.comparison-grid dt {
  color: var(--muted);
}

.comparison-grid dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.comparison-panel p {
  margin-top: 12px;
  font-size: .75rem;
  line-height: 1.6;
  color: var(--muted);
}

.report-limit {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  font-size: .75rem;
  line-height: 1.6;
  color: var(--muted);
}

.world-grid {
  margin-top: 0;
}

.world-grid > .error-banner,
.live-updated {
  grid-column: 1 / -1;
  margin: 0;
}

.scope-status,
.live-updated {
  margin-bottom: 18px;
  font-size: .8125rem;
  line-height: 1.6;
  color: var(--muted);
}

.guide-intro {
  margin-bottom: 24px;
}

.guide-intro h2 {
  margin-bottom: 8px;
  font-size: 1.125rem;
}

.guide-intro p {
  font-size: .875rem;
  line-height: 1.6;
  color: var(--muted);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.guide-card {
  margin-bottom: 18px;
  padding: 24px;
}

.guide-card h3 {
  margin: 8px 0 16px;
  font-size: 1rem;
}

.guide-card p {
  margin-bottom: 16px;
  font-size: .875rem;
  line-height: 1.65;
  color: var(--muted);
}

.guide-card .eyebrow {
  margin-bottom: 0;
  font-size: .6875rem;
}

.measurement-rules {
  display: grid;
  gap: 18px;
  margin: 0;
  font-size: .8125rem;
  line-height: 1.65;
}

.measurement-rules > div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 24px;
}

.measurement-rules dt {
  font-weight: 600;
}

.measurement-rules dd {
  margin: 0;
  color: var(--muted);
}

.guide-card table {
  min-width: 650px;
  font-size: .8125rem;
  line-height: 1.6;
}

@media (min-width: 801px) and (max-width: 1200px) {
  .app {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .overview-analysis {
    grid-template-columns: minmax(0, 1fr);
  }

  .next-steps {
    display: none;
  }

  .metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    gap: 0 24px;
  }

  .metric-group-label,
  .selected-goals-summary {
    grid-column: 1 / -1;
  }

  .metric-secondary {
    margin: 0;
    padding: 0 0 0 18px;
    border-top: 0;
    border-left: 1px solid var(--border);
  }

  .insights {
    grid-template-columns: minmax(0, 1fr);
  }

  .insight + .insight {
    padding: 16px 0 0;
    border-top: 1px solid #c8dfe4;
    border-left: 0;
  }
}

@media (max-width: 800px) {
  .app {
    display: block;
  }

  .app-header {
    position: static;
    height: auto;
  }

  .header-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 16px;
    overflow: visible;
  }

  .app-header .brand {
    padding: 0;
  }

  .app-header .brand-logo {
    width: 32px;
  }

  .site-label,
  .nav-label,
  .sidebar-bottom p {
    display: none;
  }

  .primary-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: start;
    width: auto;
    padding: 0;
    overflow: visible;
  }

  .nav-item {
    min-height: 36px;
    padding: 8px 10px;
    font-size: .75rem;
  }

  .nav-item span {
    display: none;
  }

  .sidebar-bottom {
    margin: 0;
    padding: 0;
  }

  .sidebar-bottom .logout {
    width: auto;
  }

  .header-inner .demo-banner {
    font-size: .6875rem;
  }

  main {
    padding: 24px 18px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .live-status {
    margin: 0;
  }

  h1 {
    font-size: 1.625rem;
  }

  .filters {
    gap: 12px;
  }

  .comparison-label {
    width: 100%;
    margin: 0;
  }

  .filter-group {
    flex: 1;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
    min-width: 130px;
  }

  .section-heading {
    flex-wrap: wrap;
    gap: 8px;
  }

  .insights,
  .overview-analysis,
  .guide-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .insight + .insight {
    padding: 16px 0 0;
    border-top: 1px solid #c8dfe4;
    border-left: 0;
  }

  .next-steps {
    display: none;
  }

  .report-heading,
  .report-note,
  .explorer-controls,
  .report-context,
  .report-limit {
    padding-right: 16px;
    padding-left: 16px;
  }

  .explorer-controls label {
    flex: 1;
    min-width: 160px;
  }

  .comparison-panel {
    margin-right: 16px;
    margin-left: 16px;
  }

  .comparison-grid,
  .measurement-rules > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .guide-card {
    padding: 20px;
  }

  .world-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .metric-group {
    display: block;
    padding: 18px;
  }

  .metric-secondary {
    margin-top: 16px;
    padding: 16px 0 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .header-inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar-bottom {
    grid-row: 3;
  }

  .custom-dates label,
  .custom-dates input {
    width: 100%;
  }
}

@media (pointer: coarse) {
  .nav-item,
  .sort-button,
  .metric-label,
  .session-link {
    min-height: 44px;
  }

  .comparison-cell input {
    width: 24px;
    height: 24px;
    margin: 10px;
  }
}
