:root {
  --bg: #f8fafc;
  --bg-strong: #f8fafc;
  --surface: #fff;
  --surface-strong: #fff;
  --font-sans: "Geologica", Arial, Helvetica, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --ink: #111;
  --muted: #4f5b63;
  --line: rgba(17, 17, 17, 0.12);
  --brand-blue: #023c6e;
  --brand-blue-80: #326793;
  --brand-blue-40: #acc3d5;
  --brand-green: #add5b5;
  --brand-green-60: #dfefe2;
  --accent: var(--brand-blue-80);
  --accent-deep: var(--brand-blue);
  --accent-soft: rgba(173, 213, 181, 0.45);
  --notice-banner-bg: var(--brand-blue);
  --notice-banner-ink: #fff;
  --footer-bg: var(--brand-blue);
  --footer-ink: #fff;
  --footer-heading-ink: #c8e0f8;
  --footer-muted: rgba(255, 255, 255, 0.82);
  --header-bg: var(--brand-green);
  --header-ink: var(--brand-blue);
  --header-nav-bg: var(--brand-green-60);
  --header-nav-ink: var(--brand-blue);
  --glow: rgba(173, 213, 181, 0.42);
  --shadow: 0 8px 24px rgba(2, 60, 110, 0.08);
  --radius-lg: 8px;
  --radius-md: 6px;
  --radius-sm: 999px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.notice-banner {
  background: var(--notice-banner-bg);
  color: var(--notice-banner-ink);
}

.notice-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  min-height: 44px;
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 0.8rem;
  line-height: 1.3;
  text-align: center;
}

.notice-banner-message {
  text-align: center;
}

.notice-banner-link {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.site-header {
  background: var(--header-bg);
  color: var(--header-ink);
  border-bottom: 1px solid rgba(17, 17, 17, 0.1);
  box-shadow: 0 8px 22px rgba(2, 60, 110, 0.06);
}

.header-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding-top: 18px;
  padding-bottom: 16px;
}

.header-copy {
  min-width: 0;
  justify-self: center;
  text-align: center;
}

.header-kicker {
  margin: 4px 0 0;
  color: var(--header-ink);
  font-size: 0.92rem;
  line-height: 1.4;
}

.organisation-selector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.92rem;
  line-height: 1.4;
}

.organisation-selector-label {
  white-space: nowrap;
}

.organisation-select {
  max-width: min(340px, 55vw);
  padding: 0.3rem 1.9rem 0.3rem 0.55rem;
  border: 1px solid rgba(2, 60, 110, 0.26);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.58);
  color: var(--header-ink);
  font-weight: 700;
}

.organisation-select:focus-visible,
.organisation-submit:focus-visible {
  outline: 3px solid rgba(50, 103, 147, 0.3);
  outline-offset: 2px;
}

.organisation-submit {
  padding: 0.34rem 0.62rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--header-ink);
  color: #fff;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  justify-self: end;
}

.site-header .chip {
  color: var(--header-ink);
}

.site-header .button {
  background: var(--header-ink);
  color: #fff;
}

.site-header .button-ghost {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.46);
  color: var(--header-ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--header-ink);
  text-decoration: none;
  justify-self: start;
}

.brand-logo {
  display: block;
  width: auto;
  height: 48px;
  flex-shrink: 0;
}

.site-title {
  font-family: var(--font-sans);
  font-size: clamp(1.1rem, 1.5vw, 1.5rem);
  font-weight: 700;
  letter-spacing: 0;
  text-align: center;
  text-decoration: none;
  white-space: normal;
}

.report-nav-wrap {
  background: var(--header-nav-bg);
  border-top: 1px solid rgba(17, 17, 17, 0.08);
}

.report-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 30px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.report-nav-link {
  padding: 4px 0 10px;
  border-bottom: 2px solid transparent;
  color: var(--header-nav-ink);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition:
    color 140ms ease,
    border-color 140ms ease;
}

.report-nav-link:hover {
  color: var(--header-nav-ink);
  border-bottom-color: rgba(2, 60, 110, 0.34);
}

.report-nav-link.is-active {
  color: var(--header-nav-ink);
  border-bottom-color: var(--header-nav-ink);
}

.report-nav-empty {
  padding-top: 16px;
  padding-bottom: 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.page-content {
  flex: 1;
  padding: 38px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  gap: 28px;
  align-items: stretch;
  margin-bottom: 42px;
  padding: 34px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--brand-green-60);
}

.hero > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin: 8px 0 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.hero h1,
.section-heading h1,
.section-heading h2,
.empty-state h1 {
  margin: 0 0 12px;
  color: var(--brand-blue);
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: 0;
}

.hero h1,
.section-heading h1 {
  font-size: clamp(2.3rem, 5vw, 4.3rem);
  max-width: 12ch;
}

.section-heading h2 {
  font-size: clamp(1.75rem, 3vw, 2.6rem);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-deep);
  font-weight: 600;
  letter-spacing: 0;
  font-size: 0.78rem;
}

.lede {
  max-width: 60ch;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.75;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-card,
.report-card,
.report-shell,
.empty-state {
  background: var(--surface-strong);
}

.hero-card {
  padding: 28px;
}

.hero-card h2,
.empty-state h1,
.empty-state h3,
.report-card h3 {
  margin-top: 0;
  font-family: var(--font-serif);
  font-weight: 400;
}

.empty-state {
  max-width: 720px;
  padding: 30px;
}

.checklist {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.checklist li + li {
  margin-top: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.88rem 1.14rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--brand-blue);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  transition:
    transform 140ms ease,
    background 140ms ease,
    color 140ms ease,
    border-color 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
  background: var(--brand-blue-80);
  color: #fff;
}

.button-ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
}

.button-ghost:hover {
  border-color: rgba(2, 60, 110, 0.28);
}

.chip {
  padding: 0.62rem 0.94rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(2, 60, 110, 0.18);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.chip-muted {
  background: rgba(17, 17, 17, 0.05);
  border-color: rgba(17, 17, 17, 0.08);
  color: var(--muted);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 22px;
}

.report-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
}

.report-card h3 {
  margin-bottom: 2px;
}

.report-card p {
  margin: 0 0 10px;
  color: var(--muted);
  min-height: 4.8em;
  line-height: 1.65;
}

.report-card .button {
  align-self: flex-start;
  margin-top: auto;
}

.report-shell {
  padding: 26px;
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.status {
  margin-bottom: 16px;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  background: var(--glow);
  color: var(--accent-deep);
  font-weight: 600;
}

.status.error {
  background: rgba(181, 60, 37, 0.12);
  color: #8d2b1d;
}

.powerbi-container {
  min-height: 72vh;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.report-description {
  max-width: 76ch;
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.65;
}

.warehouse-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.warehouse-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.warehouse-table th,
.warehouse-table td {
  padding: 0.82rem 0.94rem;
  border-bottom: 1px solid rgba(17, 17, 17, 0.08);
  text-align: left;
  vertical-align: top;
}

.warehouse-table th {
  position: sticky;
  top: 0;
  background: var(--brand-green-60);
  color: var(--ink);
  font-weight: 700;
}

.warehouse-table tbody tr:nth-child(even) {
  background: rgba(2, 60, 110, 0.025);
}

.product-table-toolbar {
  margin: 20px 0;
}

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

.report-summary-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.report-summary-card span {
  color: var(--muted);
}

.report-summary-card strong {
  font-size: 1.8rem;
  font-variant-numeric: tabular-nums;
}

.product-table tbody th {
  position: static;
  background: transparent;
  color: var(--ink);
}

.product-table td.product-table-metric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
  .report-summary-grid {
    grid-template-columns: 1fr;
  }
}

.report-chart {
  display: grid;
  gap: 10px;
  margin: 20px 0 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.report-chart-header,
.report-chart-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.75fr) minmax(160px, 2fr) minmax(64px, auto);
  gap: 14px;
  align-items: center;
}

.report-chart-header {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.report-chart-label,
.report-chart-value {
  min-width: 0;
  font-weight: 700;
}

.report-chart-value {
  text-align: right;
}

.report-chart-track {
  position: relative;
  display: block;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(2, 60, 110, 0.08);
}

.report-chart-bar {
  position: absolute;
  inset: 0 auto 0 0;
  min-width: 2px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
}

.report-column-chart {
  margin: 20px 0 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.report-column-chart-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.report-column-chart-scroll {
  overflow-x: auto;
  padding: 4px 2px 10px;
  scrollbar-width: thin;
}

.report-column-chart-svg {
  display: block;
  max-width: none;
}

.report-column-chart-bar {
  fill: var(--accent-deep);
}

.report-column-chart-axis {
  stroke: rgba(2, 60, 110, 0.22);
  stroke-width: 1;
}

.report-column-chart-gridline {
  stroke: rgba(2, 60, 110, 0.08);
  stroke-width: 1;
}

.report-column-chart-label {
  fill: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-anchor: end;
}

.report-column-chart-value {
  fill: var(--ink);
  font-size: 0.74rem;
  font-weight: 700;
  text-anchor: middle;
}

.stacked-report {
  margin: 22px 0 10px;
  border-top: 1px solid var(--line);
}

.stacked-report-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.report-filter {
  display: grid;
  gap: 7px;
  width: min(100%, 340px);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.report-filter select {
  width: 100%;
  min-height: 44px;
  padding: 0.62rem 2.4rem 0.62rem 0.78rem;
  border: 1px solid rgba(2, 60, 110, 0.28);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--ink);
}

.report-filter select:focus-visible {
  outline: 3px solid rgba(50, 103, 147, 0.24);
  outline-offset: 2px;
}

.stacked-report-total {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}

.stacked-report-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  padding-top: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.stacked-report-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.stacked-report-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.stacked-report-legend-swatch {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 2px;
}

.stacked-report-scroll {
  overflow-x: auto;
  padding: 8px 2px 4px;
  scrollbar-width: thin;
}

.stacked-report-svg {
  display: block;
  max-width: none;
}

.stacked-chart-axis {
  stroke: rgba(2, 60, 110, 0.24);
  stroke-width: 1;
}

.stacked-chart-gridline {
  stroke: rgba(2, 60, 110, 0.09);
  stroke-width: 1;
}

.stacked-chart-axis-label,
.stacked-chart-x-label {
  fill: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.stacked-chart-axis-label {
  text-anchor: end;
}

.stacked-chart-x-label {
  text-anchor: end;
}

.stacked-chart-total-label {
  fill: var(--ink);
  font-size: 0.74rem;
  font-weight: 700;
  text-anchor: middle;
}

.site-footer {
  margin-top: auto;
  background: var(--footer-bg);
  color: var(--footer-ink);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--font-sans);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, 0.8fr) minmax(220px, 1fr);
  gap: 30px;
  padding-top: 40px;
  padding-bottom: 28px;
}

.footer-brand,
.footer-column {
  min-width: 0;
}

.footer-logo {
  display: block;
  width: 72px;
  height: auto;
  margin-bottom: 14px;
  filter: brightness(0) invert(1);
}

.footer-motto {
  margin: 0 0 8px;
  color: var(--footer-heading-ink);
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.2;
}

.footer-heading {
  margin: 0 0 14px;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--footer-heading-ink);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  color: var(--footer-muted);
  text-decoration: none;
}

.footer-bottom a {
  color: inherit;
  text-decoration: none;
}

.footer-copy {
  margin: 0;
  max-width: 34ch;
  color: var(--footer-muted);
  line-height: 1.7;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--footer-muted);
  font-size: 0.92rem;
}

code {
  padding: 0.16rem 0.42rem;
  border-radius: 8px;
  background: rgba(2, 60, 110, 0.06);
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 860px) {
  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-inner {
    grid-template-columns: 1fr;
    justify-items: flex-start;
  }

  .topnav {
    width: 100%;
    justify-content: flex-start;
    justify-self: stretch;
  }

  .header-copy,
  .site-title {
    text-align: left;
  }

  .organisation-selector {
    justify-content: flex-start;
  }

  .report-nav {
    gap: 10px 18px;
  }

  .powerbi-container {
    min-height: 60vh;
  }
}

@media (max-width: 700px) {
  .page-content {
    padding-top: 28px;
  }

  .hero {
    padding: 26px;
  }

  .brand-logo {
    width: auto;
    height: 40px;
  }

  .report-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: thin;
  }

  .report-nav-link {
    white-space: nowrap;
  }

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

@media (max-width: 560px) {
  .shell {
    padding: 0 18px;
  }

  .stacked-report-toolbar {
    align-items: stretch;
  }

  .report-filter {
    width: 100%;
  }

  .hero h1,
  .section-heading h1,
  .section-heading h2,
  .empty-state h1 {
    max-width: none;
  }

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

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .report-chart-header {
    display: none;
  }

  .report-chart-row {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }

  .report-chart-track {
    grid-column: 1 / -1;
  }

  .report-column-chart {
    padding: 14px;
  }

  .report-column-chart-label {
    font-size: 0.7rem;
  }
}
