/* ==========================================================================
   YourQS Analytics — design tokens
   Palette: deep navy ink + paper-neutral background + steel-teal accent.
   Type: IBM Plex Sans for UI text, IBM Plex Mono for tabular figures —
   a nod to survey instruments and measured data.
   ========================================================================== */

:root {
  /* Color */
  --color-bg: #f5f6f4;
  --color-surface: #ffffff;
  --color-surface-sunken: #f0f1ee;
  --color-ink: #16233a;
  --color-ink-muted: #5b6472;
  --color-ink-faint: #8b93a1;
  --color-border: #e1e4e0;
  --color-border-strong: #c9cdc7;

  --color-accent: #2f7566;
  --color-accent-dark: #205148;
  --color-accent-tint: #e5f0ed;

  --color-warn: #a5691f;
  --color-warn-tint: #f6ecdc;
  --color-danger: #a8402f;
  --color-danger-tint: #f7e6e2;
  --color-neutral-tint: #eceef0;

  --color-sidebar-bg: #16233a;
  --color-sidebar-bg-active: #1f3350;
  --color-sidebar-text: #b7c1d1;
  --color-sidebar-text-active: #ffffff;
  --color-sidebar-border: #26344c;

  /* Type */
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Radius & shadow */
  --radius-sm: 4px;
  --radius-md: 8px;
  --shadow-sm: 0 1px 2px rgba(22, 35, 58, 0.06);
  --shadow-md: 0 4px 12px rgba(22, 35, 58, 0.08);

  --sidebar-width: 240px;
  --header-height: 64px;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p {
  margin: 0;
}

button {
  font-family: inherit;
}

table {
  border-collapse: collapse;
}

a {
  color: inherit;
}

/* Visible focus states everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   App shell
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--header-height) 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  min-height: 100vh;
}

/* ---- Sidebar ---- */

.sidebar {
  grid-area: sidebar;
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--color-sidebar-bg);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-sidebar-border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  height: var(--header-height);
  border-bottom: 1px solid var(--color-sidebar-border);
  flex-shrink: 0;
}

.sidebar-brand .header-brand-logo {
  display: block;
  width: min(100%, 112px);
  height: auto;
  max-height: calc(var(--header-height) - var(--space-3));
  object-fit: contain;
  flex: 0 1 auto;
}

.sidebar-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-brand-name {
  font-weight: 600;
  color: #fff;
  font-size: 14px;
  letter-spacing: 0.01em;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: var(--color-sidebar-text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  overflow-y: auto;
}

.sidebar-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--color-sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.sidebar-nav a.is-active {
  background: var(--color-sidebar-bg-active);
  color: var(--color-sidebar-text-active);
}

/* Signature detail: a small survey-tick mark beside the active item */
.sidebar-nav a.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--color-accent);
  border-radius: 0 2px 2px 0;
}

.sidebar-nav a.is-disabled {
  cursor: not-allowed;
  color: var(--color-ink-faint);
  opacity: 0.55;
}

.sidebar-nav a.is-disabled:hover {
  background: none;
  color: var(--color-ink-faint);
}

.nav-soon {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
  border: 1px solid var(--color-sidebar-border);
  border-radius: 3px;
  padding: 1px 5px;
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-4);
  font-size: 11.5px;
  color: var(--color-ink-faint);
  border-top: 1px solid var(--color-sidebar-border);
}

/* ---- Header ---- */

.app-header {
  grid-area: header;
  position: sticky;
  top: 0;
  z-index: 5;
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
}

.app-header .header-brand-logo {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex: 0 0 32px;
}

.header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-ink);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 12.5px;
  color: var(--color-ink-muted);
}

.header-org {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-org-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-accent-tint);
  color: var(--color-accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

/* ---- Main ---- */

.app-main {
  grid-area: main;
  padding: var(--space-6) var(--space-5) var(--space-7);
  max-width: 1360px;
  width: 100%;
  min-width: 0;
}

.page-heading {
  margin-bottom: var(--space-6);
}

.page-heading h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.page-heading p {
  margin-top: var(--space-1);
  color: var(--color-ink-muted);
  font-size: 13.5px;
}

/* ==========================================================================
   Summary cards
   ========================================================================== */

.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.summary-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
}

.summary-card-label {
  font-size: 12px;
  color: var(--color-ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.summary-card-value {
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
}

.summary-card-value.is-loading {
  color: var(--color-ink-faint);
}

.summary-state {
  margin-top: var(--space-4);
  font-size: 12.5px;
  color: var(--color-danger);
}

/* ==========================================================================
   Filters
   ========================================================================== */

.filters-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.field.field-search {
  grid-column: span 2;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-ink-muted);
}

.field input,
.field select {
  font-family: inherit;
  font-size: 13.5px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-ink);
  height: 36px;
}

.field input::placeholder {
  color: var(--color-ink-faint);
}

.field input:focus,
.field select:focus {
  border-color: var(--color-accent);
}

.filters-actions {
  margin-top: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-loading-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12.5px;
  color: var(--color-accent-dark);
}

.filter-loading-badge .spinner {
  width: 13px;
  height: 13px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: 13px;
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  height: 36px;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--color-accent-dark);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-ink);
  border-color: var(--color-border-strong);
}

.btn-secondary:hover {
  background: var(--color-surface-sunken);
}

.btn-ghost {
  background: transparent;
  color: var(--color-accent-dark);
  border-color: var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-accent-tint);
}

.btn-sm {
  height: 30px;
  padding: 0 var(--space-3);
  font-size: 12.5px;
}

/* ==========================================================================
   Results region / UI states
   ========================================================================== */

.results-region {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.ui-state {
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--color-ink-muted);
}

.ui-state[hidden] {
  display: none;
}

.ui-state-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: var(--space-2);
}

.ui-state-body {
  font-size: 13px;
  color: var(--color-ink-muted);
  max-width: 420px;
  margin: 0 auto var(--space-4);
}

.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--color-border-strong);
  border-top-color: var(--color-accent);
  animation: spin 0.7s linear infinite;
  margin: 0 auto var(--space-3);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Table
   ========================================================================== */

.table-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  position: relative;
}

.table-wrapper[aria-busy="true"] {
  opacity: 0.55;
}

.projects-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.projects-table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-ink-muted);
  background: var(--color-surface-sunken);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.projects-table thead th.col-numeric,
.projects-table td.col-numeric {
  text-align: right;
}

.projects-table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  font-size: 13.5px;
  color: var(--color-ink);
  white-space: nowrap;
}

.projects-table tbody td.col-name {
  white-space: normal;
  font-weight: 500;
  min-width: 220px;
}

.projects-table tbody td.col-numeric {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
}

.projects-table tbody tr:hover {
  background: var(--color-surface-sunken);
}

.projects-table tbody tr:last-child td {
  border-bottom: none;
}

/* Status badges */

.status-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-ready {
  background: var(--color-accent-tint);
  color: var(--color-accent-dark);
}

.status-missing-cost,
.status-missing-area {
  background: var(--color-warn-tint);
  color: var(--color-warn);
}

.status-limited {
  background: var(--color-danger-tint);
  color: var(--color-danger);
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.pagination-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: 12.5px;
  color: var(--color-ink-muted);
}

.page-size-field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.page-size-field select {
  font-family: inherit;
  font-size: 12.5px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  height: 30px;
  background: var(--color-surface);
}

.pagination-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 2px;
}

.page-number-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--color-ink-muted);
  cursor: pointer;
}

.page-number-btn:hover {
  background: var(--color-surface-sunken);
}

.page-number-btn.is-current {
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--color-ink-faint);
}

.page-indicator {
  font-size: 12.5px;
  color: var(--color-ink-muted);
  margin: 0 var(--space-2);
}

/* ==========================================================================
   Project Detail page
   Reuses existing card, panel, table, button and status tokens/patterns.
   ========================================================================== */

/* Chart colour set: desaturated, business-appropriate, distinct from status
   colours so charts never get mistaken for status signalling. */
:root {
  --chart-1: #2f7566;
  --chart-2: #3e8c9e;
  --chart-3: #6b7fa0;
  --chart-4: #8c6e4e;
  --chart-5: #a5691f;
  --chart-6: #5b6472;
  --chart-7: #7c9885;
  --chart-8: #4a5a78;
  --chart-other: #c9cdc7;
}

/* The current section's sidebar item can be both "active" (current page
   context) and "disabled" (no standalone destination without a project id)
   at once — keep the active styling on top in that case. */
.sidebar-nav a.is-active.is-disabled {
  color: var(--color-sidebar-text-active);
  opacity: 1;
  cursor: default;
}

.sidebar-nav a.is-active.is-disabled:hover {
  background: var(--color-sidebar-bg-active);
  color: var(--color-sidebar-text-active);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink-muted);
  text-decoration: none;
  margin-bottom: var(--space-4);
}

.back-link:hover {
  color: var(--color-accent-dark);
}

.back-link svg {
  flex-shrink: 0;
}

.detail-heading .page-heading-name {
  margin-top: var(--space-1);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-ink);
}

.detail-actions {
  margin-bottom: var(--space-5);
}

/* Generic card-style container, same visual language as .filters-panel */
.panel {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.panel + .panel,
.panel-section + .panel-section {
  margin-top: var(--space-5);
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: var(--space-1);
}

.panel-title-sm {
  font-size: 13.5px;
  align-self: flex-start;
}

/* A slightly larger heading than .panel-title, used to introduce a group
   of sections (e.g. "Scenario Results") without its own card chrome. */
.section-heading {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: var(--space-4);
}

.panel-subtitle {
  font-size: 12.5px;
  color: var(--color-ink-muted);
  margin-bottom: var(--space-4);
}

.panel-section {
  margin-bottom: var(--space-5);
}

/* KPI cards */

.kpi-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

/* Project information grid */

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-item-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-ink-muted);
}

.info-item-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--color-ink);
}

/* Top cost drivers */

.driver-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.driver-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-sunken);
}

.driver-rank {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-accent-tint);
  color: var(--color-accent-dark);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.driver-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-ink);
  overflow-wrap: anywhere;
}

.driver-figures {
  flex-shrink: 0;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.driver-cost {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-ink);
}

.driver-percent {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-ink-muted);
}

/* Charts layout */

.charts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: stretch;
}

/* Bar chart (top 10 scopes) */

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 150px) 1fr auto;
  align-items: center;
  gap: var(--space-3);
}

.bar-label {
  font-size: 12.5px;
  color: var(--color-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  display: block;
  height: 14px;
  border-radius: 999px;
  background: var(--color-surface-sunken);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--color-accent);
  border-radius: 999px;
}

.bar-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-ink);
  white-space: nowrap;
  min-width: 64px;
  text-align: right;
}

/* Donut distribution chart */

.donut-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}

.donut-wrapper {
  position: relative;
  width: 168px;
  height: 168px;
  flex-shrink: 0;
}

.donut {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
}

.donut-segment {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transform-origin: 50% 50%;
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.donut-segment:hover,
.donut-segment.is-active {
  transform: scale(1.035);
  filter: brightness(1.08);
  z-index: 2;
}

.donut-segment:focus-visible {
  outline: none;
  transform: scale(1.035);
  filter: brightness(1.08) drop-shadow(0 0 0 2px var(--color-accent));
  z-index: 2;
}

.donut-segment.is-muted {
  opacity: 0.55;
}

.donut-tooltip {
  position: absolute;
  z-index: 10;
  min-width: 140px;
  max-width: 200px;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  font-family: var(--font-sans);
}

.donut-tooltip[hidden] {
  display: none;
}

.donut-tooltip-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-ink);
  overflow-wrap: anywhere;
  margin-bottom: 2px;
}

.donut-tooltip-percent {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--color-accent-dark);
  font-weight: 600;
}

.donut-tooltip-cost {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--color-ink-muted);
}

.donut-center {
  position: absolute;
  inset: 22%;
  background: var(--color-surface);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--color-border);
  z-index: 3;
}

.donut-center-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-ink-muted);
}

.donut-center-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
}

.donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12.5px;
  color: var(--color-ink);
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-figures {
  flex-shrink: 0;
  font-family: var(--font-mono);
  color: var(--color-ink-muted);
  white-space: nowrap;
}

/* Full breakdown table */

.breakdown-table-wrapper {
  max-height: 560px;
  overflow-y: auto;
  margin-top: var(--space-5);
}

.breakdown-table-wrapper .projects-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Detail page ui-state variant sits inside a panel rather than the results
   region, so it needs its own (smaller) padding. */
.panel .ui-state {
  padding: var(--space-6) var(--space-4);
}

/* ==========================================================================
   Benchmarking page
   Reuses .panel, .summary-card, .info-grid, .bar-chart and .projects-table
   from the existing design system. Only genuinely new concepts — the
   position badge and percentile scale — get new, restrained styling built
   from the same 4-tier semantic palette already used for status badges.
   ========================================================================== */

.kpi-cards-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.summary-card-sub {
  margin-top: var(--space-2);
  font-size: 12px;
  font-weight: 600;
}

.summary-card-sub.is-favorable {
  color: var(--color-accent-dark);
}

.summary-card-sub.is-caution {
  color: var(--color-warn);
}

.summary-card-sub.is-neutral {
  color: var(--color-ink-muted);
}

/* Cost Position */

.position-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.position-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
}

.position-badge.is-favorable {
  background: var(--color-accent-tint);
  color: var(--color-accent-dark);
}

.position-badge.is-neutral {
  background: var(--color-neutral-tint);
  color: var(--color-ink-muted);
}

.position-badge.is-caution {
  background: var(--color-warn-tint);
  color: var(--color-warn);
}

.position-badge.is-critical {
  background: var(--color-danger-tint);
  color: var(--color-danger);
}

.position-percentile {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
}

/* Percentile scale */

.percentile-scale {
  margin-top: var(--space-4);
}

.percentile-track {
  position: relative;
  display: flex;
  height: 26px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.percentile-zone {
  display: inline-block;
  height: 100%;
}

.percentile-zone.is-favorable {
  background: var(--color-accent-tint);
}

.percentile-zone.is-neutral {
  background: var(--color-neutral-tint);
}

.percentile-zone.is-caution {
  background: var(--color-warn-tint);
}

.percentile-zone.is-critical {
  background: var(--color-danger-tint);
}

.percentile-track .percentile-zone:nth-child(1) {
  width: 40%;
}

.percentile-track .percentile-zone:nth-child(2) {
  width: 20%;
}

.percentile-track .percentile-zone:nth-child(3) {
  width: 35%;
}

.percentile-track .percentile-zone:nth-child(4) {
  width: 5%;
}

.percentile-marker {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 2px;
  background: var(--color-ink);
  transform: translateX(-1px);
}

.percentile-marker-label {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-ink);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.percentile-marker-label::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--color-ink);
}

.percentile-legend {
  display: flex;
  margin-top: var(--space-2);
}

.percentile-legend span {
  font-size: 10.5px;
  color: var(--color-ink-muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}

.percentile-legend span:nth-child(1),
.percentile-legend span:nth-child(2),
.percentile-legend span:nth-child(3),
.percentile-legend span:nth-child(4) {
  width: 20%;
}

.percentile-legend span:nth-child(5) {
  width: 15%;
}

.percentile-legend span:nth-child(6) {
  width: 5%;
}

.percentile-description {
  margin-top: var(--space-3);
  font-size: 12.5px;
  color: var(--color-ink-muted);
}

.panel-note {
  margin-top: var(--space-3);
  font-size: 12.5px;
  color: var(--color-ink-muted);
}

/* Similar projects row actions */

.row-actions {
  display: flex;
  gap: var(--space-2);
}

/* ==========================================================================
   Compare Projects page
   Reuses .filters-panel, .field, .panel, .projects-table, .bar-chart and
   the existing chart colour tokens. Each selected project gets a consistent
   identity colour (chart-1..4) shown alongside its name everywhere — never
   colour alone — in chips, table headers, and chart bars.
   ========================================================================== */

/* Search dropdown */

.project-picker-results {
  position: relative;
  margin-top: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  max-height: 280px;
  overflow-y: auto;
}

.project-picker-results[hidden] {
  display: none;
}

.picker-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: none;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.picker-result-item:last-child {
  border-bottom: none;
}

.picker-result-item:hover,
.picker-result-item:focus-visible {
  background: var(--color-surface-sunken);
}

.picker-result-item:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.picker-result-item:disabled .status-badge {
  opacity: 0.8;
}

.picker-result-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.picker-result-status-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.picker-result-meta {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--color-ink-muted);
}

.picker-result-empty {
  padding: var(--space-4);
  font-size: 12.5px;
  color: var(--color-ink-muted);
  text-align: center;
}

/* Selected project chips */

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background: var(--color-surface-sunken);
  font-size: 12.5px;
  color: var(--color-ink);
  max-width: 260px;
}

.chip-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-remove {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--color-ink-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-remove:hover {
  background: var(--color-danger-tint);
  color: var(--color-danger);
}

.picker-hint {
  font-size: 12.5px;
  color: var(--color-ink-muted);
}

.picker-hint.is-ready {
  color: var(--color-accent-dark);
}

.picker-hint.is-max {
  color: var(--color-warn);
}

/* Comparison summary cards */

.compare-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.compare-summary-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left-width: 4px;
  border-left-style: solid;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.compare-summary-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: var(--space-2);
  overflow-wrap: anywhere;
}

.compare-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-ink-muted);
}

/* Comparison table project-column headers */

.table-project-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.project-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
  display: inline-block;
}

.scope-table-wrapper {
  margin-top: var(--space-5);
}

/* Bar chart rows used for comparisons are keyboard-focusable and get a
   shared tooltip, same visual language as the donut tooltip. */

.bar-row[tabindex] {
  cursor: default;
  border-radius: var(--radius-sm);
}

.bar-row[tabindex]:hover .bar-fill,
.bar-row[tabindex].is-active .bar-fill {
  filter: brightness(1.1);
}

.bar-tooltip {
  position: absolute;
  z-index: 10;
  min-width: 140px;
  max-width: 220px;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  font-family: var(--font-sans);
}

.bar-tooltip[hidden] {
  display: none;
}

.bar-tooltip-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-ink);
  overflow-wrap: anywhere;
  margin-bottom: 2px;
}

.bar-tooltip-value {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-accent-dark);
}

/* Scope comparison groups (one mini bar-chart per scope) */

.scope-compare-group {
  margin-bottom: var(--space-4);
}

.scope-compare-group:last-child {
  margin-bottom: 0;
}

.scope-compare-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: var(--space-2);
}

.scope-compare-group .bar-chart {
  gap: var(--space-2);
}

.scope-compare-group .bar-row {
  grid-template-columns: minmax(0, 130px) 1fr auto;
}

/* ==========================================================================
   What-if Analysis page
   Reuses .filters-panel, .field, .panel, .projects-table,
   .project-picker-results and existing tokens throughout. New here: the
   live scope list with inline step/number/slider controls, the sticky
   before/after summary table, the waterfall, and the margin dumbbell —
   deliberately not more horizontal bars.
   ========================================================================== */

.table-input {
  font-family: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-ink);
  width: 90px;
  text-align: right;
}

.table-input:focus {
  border-color: var(--color-accent);
}

.table-input.is-invalid {
  border-color: var(--color-danger);
}

.field-error {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--color-danger);
}

.field-error[hidden] {
  display: none;
}

/* Live scenario summary (sticky Before/After panel) */

.wi-summary-panel {
  position: sticky;
  top: var(--space-4);
  z-index: 4;
  margin-bottom: var(--space-5);
}

.wi-summary-table {
  width: 100%;
  border-collapse: collapse;
}

.wi-summary-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-ink-muted);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.wi-summary-table th.col-numeric {
  text-align: right;
}

.wi-summary-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  color: var(--color-ink);
}

.wi-summary-table tr:last-child td {
  border-bottom: none;
}

.wi-summary-table td.col-numeric {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.wi-summary-metric {
  font-weight: 600;
}

.wi-summary-arrow {
  color: var(--color-ink-faint);
  text-align: center;
  width: 20px;
}

.wi-summary-impact {
  font-weight: 600;
}

.wi-summary-impact.is-favorable {
  color: var(--color-accent-dark);
}

.wi-summary-impact.is-caution {
  color: var(--color-warn);
}

.wi-summary-impact.is-neutral {
  color: var(--color-ink-muted);
}

.wi-summary-empty[hidden] {
  display: none;
}

#wi-updating-badge {
  margin-top: var(--space-3);
}

/* Scope search + sort controls */

.wi-scope-controls {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: var(--space-4);
  align-items: end;
}

.wi-scope-controls select {
  font-family: inherit;
  font-size: 13.5px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-ink);
  height: 36px;
}

/* Live scope list */

.wi-scope-list {
  max-height: 620px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin: var(--space-4) 0;
}

.wi-scope-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.wi-scope-row:last-child {
  border-bottom: none;
}

.wi-scope-row.is-modified {
  background: var(--color-accent-tint);
  border-left: 3px solid var(--color-accent);
}

.wi-scope-row.is-invalid-row {
  background: var(--color-danger-tint);
  border-left: 3px solid var(--color-danger);
}

.wi-scope-info {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  min-width: 0;
}

.wi-scope-name {
  font-size: 13px;
  color: var(--color-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wi-scope-cost {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--color-ink-muted);
  white-space: nowrap;
}

.wi-scope-badge {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
}

.wi-scope-badge[hidden] {
  display: none;
}

.wi-scope-controls-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.wi-step-btn {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-ink-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wi-step-btn:hover {
  background: var(--color-surface-sunken);
  color: var(--color-ink);
}

.wi-percent-input {
  width: 60px;
  text-align: center;
  padding: 3px 4px;
}

.wi-percent-sign {
  font-size: 12px;
  color: var(--color-ink-muted);
  flex-shrink: 0;
}

/* Custom slider matching the app's restrained palette */

.wi-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 110px;
  height: 4px;
  border-radius: 999px;
  background: var(--color-border-strong);
  flex-shrink: 0;
  cursor: pointer;
}

.wi-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-accent-dark);
  cursor: pointer;
}

.wi-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-accent-dark);
  cursor: pointer;
}

.wi-slider::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--color-border-strong);
}

/* ==========================================================================
   Chart.js containers
   Every canvas needs an explicit-height, positioned parent since charts
   use responsive:true + maintainAspectRatio:false.
   ========================================================================== */

.chart-container {
  position: relative;
  width: 100%;
  height: 300px;
  min-height: 220px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-container.is-compact {
  height: 220px;
}

.chart-container.is-tall {
  height: 420px;
}

/* Shown in place of a canvas when a chart cannot render (Chart.js
   unavailable, or a chart-specific error) — never leaves blank space. */
.chart-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: var(--space-4);
  text-align: center;
  font-size: 12.5px;
  color: var(--color-ink-muted);
  background: var(--color-surface-sunken);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-sm);
}

.chart-fallback[hidden] {
  display: none;
}

/* ==========================================================================
   Auth page (auth.html)
   A standalone page outside the dashboard shell — no sidebar/header, just
   a single centred card. Reuses existing tokens, .panel, .field, .btn and
   .field-error rather than introducing a parallel visual language.
   ========================================================================== */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: var(--color-bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.auth-brand-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-ink);
  letter-spacing: -0.01em;
}

.auth-tabs {
  display: flex;
  gap: 2px;
  background: var(--color-surface-sunken);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: var(--space-5);
}

.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink-muted);
  cursor: pointer;
  height: 32px;
}

.auth-tab.is-active {
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-sm);
}

.auth-alert {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--color-danger-tint);
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
  font-size: 12.5px;
}

.auth-alert[hidden] {
  display: none;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-form[hidden] {
  display: none;
}

.auth-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.auth-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--color-ink-faint);
}

.auth-password-field {
  position: relative;
}

.auth-password-field input {
  width: 100%;
  padding-right: 56px;
}

.auth-password-toggle {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--color-accent-dark);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
}

.auth-password-toggle:hover {
  text-decoration: underline;
}

.auth-switch {
  margin: 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--color-ink-muted);
}

.auth-switch button {
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  color: var(--color-accent-dark);
  cursor: pointer;
  text-decoration: underline;
}

.auth-checking-state {
  padding: var(--space-6) 0;
}

/* ==========================================================================
   Developer Preview page (dev.html)
   Reuses the existing dashboard shell, .panel/.panel-section, .field,
   .auth-form/.auth-field-row/.auth-alert (from the auth page), .btn and
   .status-badge rather than introducing a parallel visual language.
   ========================================================================== */

/* Textarea shares the same look as .field input/select, just multi-line. */
.field textarea {
  font-family: inherit;
  font-size: 13.5px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-ink);
  resize: vertical;
  min-height: 96px;
}

.field textarea:focus {
  border-color: var(--color-accent);
}

.field-hint-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.char-count {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 11px;
  color: var(--color-ink-faint);
  font-family: var(--font-mono);
}

/* Success variant for the shared .auth-alert banner, reused here for the
   feedback form's confirmation message. */
.auth-alert.is-success {
  background: var(--color-accent-tint);
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
}

/* Header user block: mirrors .sidebar-brand-text's stacked name/sub
   pattern, sized for the header's existing .header-org avatar. */
.header-user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.header-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-ink);
}

.header-user-sub {
  font-size: 11px;
  color: var(--color-ink-muted);
}

.header-user-sub:hover {
  text-decoration: underline;
}

/* Feedback status badges — reuse the existing pill shape, restrained tones
   matching the app's established 4-tier palette (favorable/neutral/caution
   already used elsewhere for Benchmarking's position badge). */
.status-feedback-new,
.status-feedback-reviewed {
  background: var(--color-neutral-tint);
  color: var(--color-ink-muted);
}

.status-feedback-planned,
.status-feedback-done {
  background: var(--color-accent-tint);
  color: var(--color-accent-dark);
}

.status-feedback-rejected {
  background: var(--color-danger-tint);
  color: var(--color-danger);
}

/* Your Submissions list */

.feedback-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.feedback-list[hidden] {
  display: none;
}

.feedback-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-sunken);
}

.feedback-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.feedback-item-category {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-ink);
}

.feedback-item-message {
  margin: 0 0 var(--space-2);
  font-size: 13px;
  color: var(--color-ink);
  overflow-wrap: anywhere;
}

.feedback-item-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 11.5px;
  color: var(--color-ink-muted);
}

/* Future Platform Development card — visually distinct via a left accent
   border, still built from the same panel/typography tokens. */
.future-card {
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-sm);
  background: var(--color-surface-sunken);
  padding: var(--space-4) var(--space-5);
}

.future-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

.future-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-ink);
}

.future-card-body {
  margin: 0 0 var(--space-3);
  font-size: 13px;
  color: var(--color-ink-muted);
}

.capability-list {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-5);
  font-size: 12.5px;
  color: var(--color-ink);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Prototype Scope */

.scope-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

.scope-column-title {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-ink-muted);
  margin-bottom: var(--space-2);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1100px) {
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .field.field-search {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 76px 1fr;
  }
  .sidebar-brand-text,
  .sidebar-nav a span.nav-label,
  .nav-soon {
    display: none;
  }
  .sidebar-nav a {
    justify-content: center;
    padding: var(--space-3);
  }
  .sidebar-nav a.is-active::before {
    display: none;
  }
  .summary-cards {
    grid-template-columns: 1fr;
  }
  .kpi-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi-cards-3 {
    grid-template-columns: 1fr;
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .compare-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .wi-scope-controls {
    grid-template-columns: 1fr;
  }
  .wi-scope-row {
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: var(--space-2);
  }
  .wi-scope-controls-row {
    width: 100%;
  }
  .wi-slider {
    flex: 1;
    min-width: 60px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
  }
  .sidebar {
    display: none;
  }
  .app-main {
    padding: var(--space-5) var(--space-4) var(--space-6);
  }
  .filters-grid {
    grid-template-columns: 1fr;
  }
  .field.field-search {
    grid-column: span 1;
  }
  .filters-actions {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }
  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .pagination-right {
    justify-content: center;
    flex-wrap: wrap;
  }
  .kpi-cards {
    grid-template-columns: 1fr;
  }
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bar-row {
    grid-template-columns: 96px 1fr auto;
  }
  .donut-wrapper {
    width: 140px;
    height: 140px;
  }
  .kpi-cards-3 {
    grid-template-columns: 1fr;
  }
  .percentile-legend span:nth-child(5),
  .percentile-legend span:nth-child(6) {
    font-size: 9.5px;
  }
  .row-actions {
    flex-direction: column;
  }
  .compare-summary-grid {
    grid-template-columns: 1fr;
  }
  .chip {
    max-width: 200px;
  }
  .scope-compare-group .bar-row {
    grid-template-columns: 96px 1fr auto;
  }
  .wi-summary-table {
    font-size: 12px;
  }
  .wi-summary-panel {
    position: static;
  }
  .chart-container {
    height: 240px;
  }
  .chart-container.is-tall {
    height: 340px;
  }
  .auth-field-row {
    grid-template-columns: 1fr;
  }
  .auth-card {
    max-width: none;
  }
  .scope-columns {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  .future-card {
    padding: var(--space-4);
  }
}


/* ==========================================================================
   Header account / authentication
   ========================================================================== */

[hidden] {
  display: none !important;
}

.header-account {
  display: flex;
  align-items: center;
  gap: var(--space-2);

  padding: 5px 8px;
  margin: -5px -8px;

  border-radius: var(--radius-sm);

  color: inherit;
  text-decoration: none;

  transition:
    background-color 120ms ease;
}

.header-account:hover {
  background: var(--color-surface-sunken);
}

.header-user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  text-align: left;
}

.header-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-ink);
}

.header-user-sub {
  font-size: 10.5px;
  color: var(--color-ink-muted);
}

/* ==========================================================================
   Developer Preview — shared submissions
   ========================================================================== */

.feedback-list-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.feedback-list-header .panel-subtitle { margin-bottom: 0; }
.feedback-tabs {
  display: inline-flex;
  gap: 2px;
  flex-shrink: 0;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-sunken);
}
.feedback-tab {
  height: 30px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-ink-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.feedback-tab:hover { color: var(--color-ink); }
.feedback-tab.is-active {
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: var(--shadow-sm);
}
.feedback-author {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.feedback-author-avatar {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-accent-tint);
  color: var(--color-accent-dark);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
}
.feedback-author-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.feedback-author-name-row { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.feedback-author-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--color-ink); font-size: 12.5px; font-weight: 600;
}
.feedback-author-company {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--color-ink-muted); font-size: 10.5px;
}
.feedback-you-badge {
  flex-shrink: 0; padding: 1px 6px; border-radius: 999px;
  background: var(--color-accent-tint); color: var(--color-accent-dark);
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
@media (max-width: 640px) {
  .feedback-list-header { flex-direction: column; align-items: stretch; }
  .feedback-tabs { align-self: flex-start; }
}
