:root {
  color-scheme: light;
  --color-bg: #E8EBF0;
  --color-surface: #FFFFFF;
  --color-sidebar: #FBFBFD;
  --color-field: #F4F5F8;
  --color-primary: #6C5CE7;
  --color-primary-dark: #5B4BD6;
  --color-primary-light: #7B6EF6;
  --color-lavender: #C7C2F5;
  --color-teal: #1ABC9C;
  --color-green-accent: #00C9A7;
  --color-mint: #7EE0D0;
  --color-text: #1E2233;
  --color-text-muted: #6B7280;
  --color-text-subtle: #9CA3AF;
  --color-success: #16A34A;
  --color-success-bg: #DCFCE7;
  --color-danger: #EF4444;
  --color-danger-bg: #FEE2E2;
  --color-data-purple: #8E44AD;
  --color-data-blue: #4F6FF5;
  --color-border: #EEF0F4;
  --risk-low: #1ABC9C;
  --risk-medium: #359CB5;
  --risk-serious: #517CCE;
  --risk-high: #6C5CE7;
  --radius-card: 6px;
  --radius-md: 6px;
  --radius-sm: 5px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgb(30 34 51 / 4%);
  --shadow-card-hover: 0 4px 14px rgb(30 34 51 / 7%);
  --shadow-panel: 0 12px 34px rgb(30 34 51 / 8%);
  --fs-display: 30px;
  --fs-section: 19px;
  --fs-card-title: 16px;
  --fs-body: 14px;
  --fs-label: 13px;
  --fs-caption: 12px;
  --fs-overline: 11px;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --bg: var(--color-bg);
  --panel: var(--color-surface);
  --panel-strong: var(--color-field);
  --sidebar-bg: var(--color-sidebar);
  --ink: var(--color-text);
  --muted: var(--color-text-muted);
  --subtle: var(--color-text-subtle);
  --line: var(--color-border);
  --brand: var(--color-primary);
  --brand-dark: var(--color-primary-dark);
  --brand-light: var(--color-primary-light);
  --brand-2: var(--color-teal);
  --brand-3: var(--color-data-blue);
  --lavender: var(--color-lavender);
  --green: var(--color-green-accent);
  --red: var(--color-danger);
  --success: var(--color-success);
  --success-bg: var(--color-success-bg);
  --danger-bg: var(--color-danger-bg);
  --data-purple: var(--color-data-purple);
  --data-blue: var(--color-data-blue);
  --shadow: var(--shadow-card);
  --radius: var(--radius-card);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

button {
  cursor: pointer;
}

.material-symbols-rounded.material-icon {
  align-items: center;
  display: inline-flex;
  font-family: "Material Symbols Rounded";
  font-size: 20px;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
  font-weight: normal;
  height: 20px;
  justify-content: center;
  line-height: 1;
  width: 20px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(108 92 231 / 26%);
  outline-offset: 2px;
}

.skip-link {
  background: var(--brand);
  border-radius: 0 0 7px 0;
  color: var(--panel);
  font-weight: var(--fw-bold);
  left: 0;
  padding: 10px 14px;
  position: fixed;
  top: 0;
  transform: translateY(-120%);
  z-index: 50;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  height: 42px;
  width: 42px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--ink);
  font-size: var(--fs-section);
  font-weight: var(--fw-bold);
  letter-spacing: 0;
  line-height: 1.15;
}

h2 {
  color: var(--ink);
  font-size: var(--fs-section);
  font-weight: var(--fw-semibold);
  letter-spacing: 0;
  line-height: 1.2;
}

.brand-lockup p,
.muted,
small {
  color: var(--muted);
}

.toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.auth-status {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: inline-flex;
  gap: 8px;
  min-height: 38px;
  padding: 3px 4px 3px 10px;
}

.auth-status span {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button,
.small-button,
.text-button,
.danger-button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  display: inline-flex;
  font-weight: var(--fw-semibold);
  justify-content: center;
  min-height: 38px;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.icon-button {
  font-size: 1.15rem;
  height: 38px;
  width: 38px;
}

.text-button,
.small-button {
  padding: 0 12px;
}

.text-button {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--panel);
}

.small-button {
  min-height: 32px;
}

.plan-entry-actions .small-button.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--panel);
}

.plan-entry-actions .small-button.is-passive {
  background: var(--panel-strong);
  border-color: var(--line);
  color: var(--muted);
}

.plan-entry-actions .small-button.is-success {
  background: var(--success-bg);
  border-color: rgb(22 163 74 / 22%);
  color: var(--success);
  opacity: 1;
}

.icon-button:hover,
.small-button:hover,
.text-button:hover,
.danger-button:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
}

.danger-button {
  background: var(--panel);
  border-color: var(--danger-bg);
  color: var(--red);
  min-height: 34px;
  padding: 0 12px;
}

.danger-button:hover,
.danger-outline:hover {
  border-color: var(--red);
  color: var(--red);
}

.danger-outline {
  background: var(--panel);
  border-color: var(--danger-bg);
  color: var(--red);
}

.workspace {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr) minmax(320px, 380px);
  padding: 16px;
}

.sidebar,
.content,
.detail-panel {
  min-width: 0;
}

.sidebar,
.detail-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-panel,
.model-panel,
.matrix-panel,
.actions-panel,
.portfolio-panel,
.detail-panel form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 1px rgb(238 240 244 / 70%);
}

.filter-panel,
.model-panel,
.matrix-panel,
.actions-panel,
.portfolio-panel {
  padding: 14px;
}

.matrix-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.detail-panel {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 108px);
}

.detail-panel form {
  overflow: auto;
  overflow-x: hidden;
  padding: 14px;
}

.section-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  gap: 6px;
}

.field-with-hint > span {
  color: var(--muted);
  font-weight: var(--fw-medium);
}

.field-hint {
  color: var(--subtle);
  font-size: var(--fs-caption);
  font-weight: var(--fw-regular);
  line-height: 1.35;
}

input,
select,
textarea {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  min-height: 42px;
  padding: 9px 10px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  outline: 3px solid rgb(108 92 231 / 14%);
}

input,
select {
  height: 42px;
}

textarea {
  line-height: 1.5;
  min-height: 112px;
  resize: vertical;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 18px,
    calc(100% - 11px) 18px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  padding-right: 32px;
}

.filter-panel {
  display: grid;
  gap: 12px;
}

.model-panel {
  display: grid;
  gap: 10px;
}

.model-panel .section-heading {
  margin-bottom: 0;
}

.model-summary {
  color: var(--muted);
  font-size: var(--fs-label);
  line-height: 1.4;
}

.model-explainer {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.model-explainer summary {
  background: var(--panel-strong);
  color: var(--ink);
  cursor: pointer;
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  list-style: none;
  padding: 9px 10px;
}

.model-explainer summary::-webkit-details-marker {
  display: none;
}

.model-explainer summary::after {
  color: var(--muted);
  content: "expand_more";
  float: right;
  font-family: "Material Symbols Rounded";
  font-size: 18px;
  font-weight: normal;
  line-height: 1;
}

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

.model-explainer[open] summary::after {
  content: "expand_less";
}

.model-concept {
  align-items: start;
  background: var(--panel-strong);
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: grid;
  font-size: var(--fs-caption);
  gap: 8px;
  grid-template-columns: 18px minmax(0, 1fr);
  line-height: 1.35;
  padding: 8px 9px;
}

.model-concept:first-of-type {
  border-top: 0;
}

.model-explainer .material-icon {
  color: var(--brand);
  font-size: 17px;
  height: 18px;
  margin-top: 1px;
  width: 18px;
}

.model-explainer strong {
  color: var(--ink);
  display: block;
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
}

.model-panel .section-heading {
  position: relative;
}

.model-tooltip {
  background: var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  color: var(--panel);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  line-height: 1.35;
  max-width: min(320px, 76vw);
  opacity: 0;
  padding: 10px 12px;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
  visibility: hidden;
  z-index: 8;
}

.model-panel .info-button:hover ~ .model-tooltip,
.model-panel .info-button:focus ~ .model-tooltip,
.model-panel .info-button:focus-visible ~ .model-tooltip,
.model-panel .section-heading:focus-within .model-tooltip {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.weight-row,
.model-weight-control {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  gap: 8px;
  padding: 10px;
}

.weight-row {
  display: flex;
  justify-content: space-between;
}

.model-weight-label {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.model-weight-label label {
  color: var(--ink);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
}

.model-weight-label strong {
  color: var(--ink);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  text-align: right;
}

.model-weight-label strong span:nth-child(odd) {
  color: var(--muted);
  font-weight: var(--fw-medium);
}

.model-weight-control input[type="range"] {
  --driver-value: 50;
  --driver-color: var(--brand);
  appearance: none;
  background: linear-gradient(90deg, var(--risk-low) 0%, var(--risk-medium) 34%, var(--risk-serious) 67%, var(--risk-high) 100%);
  border: 0;
  border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 1px rgb(30 34 51 / 8%);
  height: 8px;
  min-height: 8px;
  padding: 0;
}

.model-weight-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  background: var(--panel);
  border: 2px solid var(--driver-color);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 12px rgb(108 92 231 / 18%);
  height: 18px;
  width: 18px;
}

.model-weight-control input[type="range"]::-moz-range-thumb {
  background: var(--panel);
  border: 2px solid var(--driver-color);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 12px rgb(108 92 231 / 18%);
  height: 14px;
  width: 14px;
}

.model-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  gap: 8px;
  padding: 10px;
}

.model-preview > span {
  color: var(--ink);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-preview div {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.model-preview div span {
  color: var(--muted);
  font-size: var(--fs-caption);
}

.model-preview div strong {
  color: var(--ink);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
}

.content {
  display: grid;
  gap: 16px;
}

.panel-controls {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 8px;
}

.panel-controls label {
  align-items: center;
  display: flex;
  gap: 8px;
}

.panel-controls select {
  height: 32px;
  min-height: 32px;
  min-width: 76px;
  padding-bottom: 5px;
  padding-top: 5px;
}

.pagination-controls {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.pagination-controls .icon-button {
  height: 30px;
  min-height: 30px;
  width: 30px;
}

.pagination-controls span:not(.material-icon) {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  min-width: 42px;
  text-align: center;
}

.metric-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 1px rgb(238 240 244 / 70%);
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 92px;
  padding: 14px;
  text-align: left;
}

.metric-card .metric-label {
  color: var(--muted);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  line-height: 1.25;
}

.metric-card strong {
  color: var(--ink);
  font-size: var(--fs-display);
  font-weight: var(--fw-bold);
  grid-column: 1 / -1;
  letter-spacing: 0;
  line-height: 1;
}

.metric-icon {
  align-items: center;
  background: rgb(126 224 208 / 22%);
  border-radius: 7px;
  color: var(--brand);
  display: inline-flex;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.metric-critical {
  background: var(--panel);
}

.metric-high {
  background: var(--panel);
}

.metric-score {
  background: rgb(var(--metric-risk-rgb, 81 124 206));
  border-color: rgb(var(--metric-risk-rgb, 81 124 206));
  color: var(--panel);
  box-shadow:
    var(--shadow),
    inset 0 0 0 1px rgb(255 255 255 / 18%);
}

.metric-score .metric-label,
.metric-score strong {
  color: var(--panel);
}

.metric-score .metric-icon {
  background: rgb(255 255 255 / 18%);
  color: var(--panel);
}

.metric-action {
  background: var(--panel);
}

.board-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(450px, 1.25fr) minmax(300px, 0.85fr);
}

.distribution-toggle {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
}

.distribution-toggle button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  display: inline-flex;
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  gap: 6px;
  justify-content: center;
  min-height: 34px;
  padding: 6px 8px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.distribution-toggle button:hover,
.distribution-toggle button:focus-visible {
  color: var(--brand-dark);
}

.distribution-toggle button.active,
.distribution-toggle button[aria-pressed="true"] {
  background: var(--panel);
  border-color: var(--brand);
  color: var(--brand-dark);
  box-shadow: 0 1px 3px rgb(30 34 51 / 6%);
}

.risk-matrix {
  display: grid;
  gap: 10px;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100%;
}

.density-summary {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: space-between;
  padding: 9px 10px;
}

.density-summary span {
  display: grid;
  gap: 1px;
}

.density-summary span:last-child {
  min-width: 56px;
  text-align: right;
}

.density-summary strong {
  color: var(--ink);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  line-height: 1.25;
}

.density-summary small {
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.25;
}

.density-summary span:last-child small {
  white-space: nowrap;
}

.risk-map-shell {
  display: grid;
  gap: 8px;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-rows: clamp(260px, 34vh, 330px) auto auto;
  min-height: 0;
}

.density-grid {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-column: 2;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
}

.density-cell {
  align-items: center;
  background: rgb(var(--cell-tone, 108 92 231) / var(--density-alpha, 0.08));
  border: 1px solid rgb(var(--cell-tone, 108 92 231) / 20%);
  border-radius: var(--radius-sm);
  color: var(--ink);
  display: grid;
  gap: 2px;
  justify-items: center;
  min-height: 0;
  min-width: 0;
  padding: 7px 4px;
  position: relative;
  text-align: center;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.density-count {
  color: var(--ink);
  display: block;
  font-size: 17px;
  font-weight: var(--fw-bold);
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.density-average {
  align-items: baseline;
  color: var(--muted);
  display: inline-flex;
  font-size: var(--fs-overline);
  gap: 3px;
  justify-content: center;
  line-height: 1;
  max-width: 100%;
  overflow: visible;
  white-space: nowrap;
}

.density-average b {
  color: var(--muted);
  font-size: var(--fs-overline);
  font-weight: var(--fw-semibold);
  line-height: 1;
}

.density-cell:not(:disabled):hover,
.density-cell:not(:disabled):focus-visible {
  border-color: var(--brand);
  box-shadow: 0 8px 18px rgb(30 34 51 / 12%);
  transform: translateY(-1px);
}

.density-cell.selected {
  border-color: var(--brand);
  box-shadow:
    inset 0 0 0 2px rgb(255 255 255 / 90%),
    0 0 0 3px rgb(108 92 231 / 20%);
}

.density-cell.selected::after {
  background: var(--brand);
  border: 2px solid var(--panel);
  border-radius: 999px;
  content: "";
  height: 8px;
  position: absolute;
  right: 5px;
  top: 5px;
  width: 8px;
}

.density-cell.empty {
  background: rgb(var(--cell-tone, 108 92 231) / var(--density-alpha, 0.11));
  border-color: rgb(var(--cell-tone, 108 92 231) / 16%);
}

.density-cell:disabled {
  cursor: default;
}

.risk-matrix-summary {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 2px;
  padding: 9px 10px;
}

.risk-matrix-summary strong {
  color: var(--ink);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  line-height: 1.25;
}

.risk-matrix-summary small {
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.3;
}

.matrix-score-note {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  line-height: 1.3;
}

.matrix-filter-state,
.portfolio-filter-state {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 8px 10px;
}

.portfolio-filter-state {
  margin-bottom: 10px;
}

.matrix-filter-state span,
.portfolio-filter-state span {
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  line-height: 1.35;
}

.matrix-filter-state strong,
.portfolio-filter-state strong {
  color: var(--ink);
  font-weight: var(--fw-semibold);
}

.matrix-filter-state .small-button,
.portfolio-filter-state .small-button {
  flex: 0 0 auto;
  min-height: 30px;
}

.matrix-shell {
  align-self: center;
  display: grid;
  gap: 7px;
  grid-template-columns: 18px 86px minmax(0, 1fr);
  grid-template-rows: auto minmax(248px, 32vh) auto;
  justify-self: center;
  max-width: 540px;
  width: 100%;
}

.matrix-y-title {
  align-self: center;
  color: var(--ink);
  font-size: var(--fs-overline);
  font-weight: var(--fw-semibold);
  grid-column: 1;
  grid-row: 1 / 3;
  justify-self: center;
  letter-spacing: 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.matrix-corner {
  grid-column: 2;
  grid-row: 1;
}

.matrix-column-headings {
  display: grid;
  gap: 7px;
  grid-column: 3;
  grid-row: 1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.matrix-row-headings {
  display: grid;
  gap: 7px;
  grid-column: 2;
  grid-row: 2;
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.matrix-column-headings span,
.matrix-row-headings span {
  align-items: center;
  color: var(--muted);
  display: grid;
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  gap: 1px;
  justify-items: center;
  line-height: 1.15;
  min-width: 0;
  text-align: center;
}

.matrix-row-headings span {
  justify-items: end;
  text-align: right;
}

.matrix-column-headings b,
.matrix-row-headings b {
  color: var(--ink);
  font-weight: var(--fw-semibold);
  line-height: 1.1;
  overflow: visible;
  overflow-wrap: anywhere;
  white-space: normal;
  width: 100%;
}

.matrix-column-headings strong,
.matrix-row-headings strong {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
}

.matrix-grid {
  display: grid;
  gap: 7px;
  grid-column: 3;
  grid-row: 2;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.risk-matrix-cell {
  align-content: center;
  background: rgb(var(--matrix-color, 26 188 156));
  border: 1px solid rgb(var(--matrix-color, 26 188 156));
  border-radius: var(--radius);
  box-shadow: 0 4px 10px rgb(30 34 51 / 7%);
  color: #fff;
  display: grid;
  justify-items: center;
  min-height: 68px;
  min-width: 0;
  padding: 10px 6px;
  position: relative;
  text-align: center;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.risk-matrix-cell.level-low,
.risk-matrix-cell.level-medium,
.risk-matrix-cell.level-serious,
.risk-matrix-cell.level-high {
  background: rgb(var(--matrix-color, 26 188 156));
  border-color: rgb(var(--matrix-color, 26 188 156));
  color: #fff;
}

.risk-matrix-cell:not(:disabled):hover,
.risk-matrix-cell:not(:disabled):focus-visible {
  border-color: var(--ink);
  box-shadow: 0 10px 20px rgb(30 34 51 / 16%);
  transform: translateY(-1px);
}

.risk-matrix-cell.selected {
  box-shadow:
    inset 0 0 0 2px rgb(255 255 255 / 86%),
    0 0 0 3px rgb(108 92 231 / 22%),
    0 10px 20px rgb(30 34 51 / 16%);
}

.risk-matrix-cell.empty {
  opacity: 0.88;
}

.risk-matrix-cell:disabled {
  cursor: default;
}

.matrix-cell-level {
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  line-height: 1.15;
}

.risk-matrix-cell strong {
  align-items: center;
  color: #fff;
  display: inline-grid;
  font-size: var(--fs-card-title);
  font-weight: var(--fw-medium);
  gap: 1px;
  justify-items: center;
  line-height: 1.05;
}

.risk-matrix-cell strong span {
  color: rgb(255 255 255 / 82%);
  font-size: var(--fs-overline);
  font-weight: var(--fw-semibold);
  line-height: 1;
}

.matrix-employee-count {
  align-items: center;
  background: rgb(255 255 255 / 92%);
  border: 1px solid rgb(30 34 51 / 8%);
  border-radius: var(--radius-pill);
  color: var(--ink);
  display: inline-flex;
  font-size: var(--fs-overline);
  font-weight: var(--fw-semibold);
  height: 18px;
  justify-content: center;
  min-width: 18px;
  padding: 0 5px;
  position: absolute;
  right: 5px;
  top: 5px;
}

.matrix-x-title {
  color: var(--ink);
  font-size: var(--fs-overline);
  font-weight: var(--fw-semibold);
  grid-column: 3;
  grid-row: 3;
  justify-self: center;
  letter-spacing: 0;
}

.priority-band-chart {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  padding: 8px;
}

.priority-band {
  align-items: center;
  background:
    linear-gradient(90deg, rgb(var(--band-tone, 108 92 231) / var(--band-alpha, 0.14)), rgb(var(--band-tone, 108 92 231) / 7%)),
    var(--panel);
  border: 1px solid rgb(var(--band-tone, 108 92 231) / 24%);
  border-radius: var(--radius-sm);
  color: var(--ink);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(86px, 0.8fr) minmax(92px, 1fr) 42px 50px;
  min-height: 62px;
  min-width: 0;
  padding: 9px 10px;
  position: relative;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.priority-band:not(:disabled):hover,
.priority-band:not(:disabled):focus-visible {
  border-color: var(--brand);
  box-shadow: 0 8px 18px rgb(30 34 51 / 12%);
  transform: translateY(-1px);
}

.priority-band.selected {
  border-color: var(--brand);
  box-shadow:
    inset 0 0 0 2px rgb(255 255 255 / 90%),
    0 0 0 3px rgb(108 92 231 / 18%);
}

.priority-band.empty {
  background: var(--panel);
  border-color: var(--line);
}

.priority-band:disabled {
  cursor: default;
}

.priority-band-heading,
.priority-band-body,
.priority-band-footer {
  display: grid;
  min-width: 0;
}

.priority-band-heading strong {
  color: var(--ink);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.priority-band-heading small,
.priority-band-body small,
.priority-band-footer span {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  line-height: 1.25;
}

.priority-band-body b {
  color: var(--ink);
  font-size: var(--fs-card-title);
  font-weight: var(--fw-bold);
  letter-spacing: 0;
  line-height: 1;
}

.priority-band-meter {
  align-items: center;
  background: rgb(30 34 51 / 4%);
  border: 1px solid rgb(30 34 51 / 5%);
  border-radius: var(--radius-sm);
  display: flex;
  height: 12px;
  padding: 3px;
}

.priority-band-meter span {
  background: rgb(var(--band-tone, 108 92 231) / 74%);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 30%);
  display: block;
  height: 100%;
  min-width: 0;
}

.priority-band-footer {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: space-between;
}

.priority-band-footer strong {
  color: var(--ink);
  font-size: var(--fs-card-title);
  font-weight: var(--fw-semibold);
  line-height: 1;
}

.risk-map-x-label {
  color: var(--muted);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: 0;
}

.risk-y-guide {
  align-items: center;
  color: var(--muted);
  display: grid;
  grid-column: 1;
  grid-row: 1;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
}

.risk-y-guide strong {
  align-self: center;
  color: var(--muted);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  transform: rotate(-90deg);
}

.risk-y-guide span {
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
}

.risk-map-x-label {
  grid-column: 2;
  justify-self: center;
}

.risk-axis {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
}

.x-axis {
  display: flex;
  grid-column: 2;
  justify-content: space-between;
}

.risk-legend {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.risk-legend span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: var(--fs-overline);
  font-weight: var(--fw-medium);
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
}

.legend-swatch {
  border-radius: 999px;
  flex: 0 0 auto;
  display: inline-block;
  height: 8px;
  width: 8px;
}

.legend-swatch.level-low {
  background: var(--risk-low);
}

.legend-swatch.level-medium {
  background: var(--risk-medium);
}

.legend-swatch.level-serious {
  background: var(--risk-serious);
}

.legend-swatch.level-high {
  background: var(--risk-high);
}

.risk-map-note {
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.35;
}

.action-list {
  display: grid;
  gap: 7px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.action-item {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  display: grid;
  gap: 8px;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  min-height: 52px;
  padding: 8px 9px;
  text-align: left;
  width: 100%;
}

.action-item:hover {
  border-color: var(--brand);
}

.action-item.selected {
  background: var(--sidebar-bg);
  border-color: var(--brand);
  box-shadow: inset 3px 0 0 var(--brand);
}

.action-item.overdue {
  border-color: var(--red);
  box-shadow: inset 3px 0 0 var(--red);
}

.actions-panel.attention {
  animation: panel-attention 900ms ease;
}

.action-item strong,
.action-item small {
  display: block;
}

.action-item > span:nth-child(2) {
  min-width: 0;
}

.action-item strong {
  color: var(--ink);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.action-item small {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-regular);
  line-height: 1.3;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.action-item em {
  color: var(--subtle);
  display: block;
  font-size: var(--fs-caption);
  font-style: normal;
  font-weight: var(--fw-medium);
  margin-top: 3px;
}

.action-item.overdue em {
  color: var(--red);
}

.risk-dot {
  background: rgb(var(--priority-rgb, 199 194 245) / 66%);
  border: 1px solid rgb(var(--priority-rgb, 199 194 245) / 70%);
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgb(var(--priority-rgb, 199 194 245) / 18%);
  height: 10px;
  width: 10px;
}

.action-item b {
  color: var(--ink);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
}

.portfolio-panel {
  min-width: 0;
}

.table-wrap {
  overflow: visible;
  width: 100%;
}

table {
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

th:nth-child(1),
td:nth-child(1) {
  width: 16%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 7%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 15%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 20%;
}

th:nth-child(5),
td:nth-child(5),
th:nth-child(6),
td:nth-child(6) {
  width: 11%;
}

th:nth-child(7),
td:nth-child(7) {
  width: 9%;
}

th:nth-child(8),
td:nth-child(8) {
  width: 11%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 7px;
  text-align: left;
  vertical-align: middle;
}

th:first-child,
td:first-child {
  padding-left: 10px;
}

th:last-child,
td:last-child {
  padding-right: 10px;
}

th {
  color: var(--muted);
  font-size: var(--fs-overline);
  font-weight: var(--fw-semibold);
  letter-spacing: 0;
  overflow-wrap: normal;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 1;
}

.sort-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  display: inline-flex;
  gap: 4px;
  font-size: inherit;
  font-weight: inherit;
  min-height: 28px;
  padding: 0;
  text-align: left;
  width: 100%;
}

.sort-button:hover,
.sort-button:focus-visible {
  color: var(--brand);
}

td {
  color: var(--ink);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

td strong,
td small {
  display: block;
}

td strong,
.row-select strong {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
}

td small {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-regular);
}

.assessment-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.assessment-chip {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  display: inline-flex;
  gap: 3px;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 5px;
}

.assessment-chip .material-icon {
  flex: 0 0 auto;
  font-size: 15px;
  height: 15px;
  width: 15px;
}

.assessment-chip span:not(.material-icon) {
  font-size: var(--fs-overline);
  font-weight: var(--fw-semibold);
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assessment-chip.is-low {
  background: rgb(26 188 156 / 11%);
  border-color: rgb(26 188 156 / 28%);
  color: var(--risk-low);
}

.assessment-chip.is-medium {
  background: rgb(53 156 181 / 11%);
  border-color: rgb(53 156 181 / 28%);
  color: var(--risk-medium);
}

.assessment-chip.is-serious {
  background: rgb(81 124 206 / 11%);
  border-color: rgb(81 124 206 / 28%);
  color: var(--risk-serious);
}

.assessment-chip.is-high {
  background: rgb(108 92 231 / 11%);
  border-color: rgb(108 92 231 / 28%);
  color: var(--risk-high);
}

.row-select {
  background: transparent;
  border: 0;
  color: var(--ink);
  font-weight: inherit;
  padding: 0;
  text-align: left;
}

.row-select:hover {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

tr[data-id] {
  cursor: pointer;
}

tr[data-id]:hover {
  background: var(--sidebar-bg);
}

tr.selected {
  background: var(--panel-strong);
}

.level-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  justify-content: center;
  max-width: 100%;
  min-width: 0;
  padding: 4px 8px;
  white-space: nowrap;
}

.level-high {
  background: rgb(108 92 231 / 14%);
  color: var(--risk-high);
}

.level-serious {
  background: rgb(81 124 206 / 14%);
  color: var(--risk-serious);
}

.level-medium {
  background: rgb(53 156 181 / 14%);
  color: var(--risk-medium);
}

.level-low {
  background: rgb(26 188 156 / 14%);
  color: var(--risk-low);
}

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

.form-grid > label,
.score-strip > div,
fieldset {
  min-width: 0;
}

input[type="datetime-local"] {
  font-size: var(--fs-label);
  padding-right: 8px;
}

.full {
  grid-column: 1 / -1;
}

.score-strip {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin: 14px 0;
  padding: 10px;
}

.score-strip div {
  display: grid;
  gap: 4px;
}

.score-strip span {
  color: var(--muted);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
}

.score-strip strong {
  color: var(--ink);
  font-size: var(--fs-card-title);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
}

.detail-empty {
  background: var(--panel-strong);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  padding: 16px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 14px 0 0;
  padding: 12px;
}

.mitigation-toggle {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
  margin-bottom: 10px;
  padding: 10px;
}

.mitigation-toggle input {
  appearance: none;
  background: var(--color-text-subtle);
  border: 0;
  border-radius: var(--radius-pill);
  height: 22px;
  min-height: 22px;
  padding: 0;
  position: relative;
  transition: background 160ms ease;
  width: 40px;
}

.mitigation-toggle input::after {
  background: var(--panel);
  border-radius: var(--radius-pill);
  box-shadow: 0 1px 3px rgb(30 34 51 / 18%);
  content: "";
  height: 18px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: transform 160ms ease;
  width: 18px;
}

.mitigation-toggle input:checked {
  background: var(--brand);
}

.mitigation-toggle input:checked::after {
  transform: translateX(18px);
}

.mitigation-toggle strong {
  color: var(--ink);
  display: block;
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
}

.mitigation-toggle small {
  color: var(--muted);
  display: block;
  font-size: var(--fs-caption);
  line-height: 1.35;
  margin-top: 2px;
}

.mitigation-fields.is-disabled {
  opacity: 0.56;
}

.mitigation-fields.is-disabled input,
.mitigation-fields.is-disabled select,
.mitigation-fields.is-disabled textarea {
  cursor: not-allowed;
}

.form-actions {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  margin-top: 14px;
}

.plan-entry-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.action-history {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
}

.action-history.is-disabled {
  border-top-style: dashed;
}

.action-history-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.action-history-heading strong {
  color: var(--ink);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
}

.action-history-heading span {
  color: var(--muted);
  font-size: var(--fs-caption);
}

.action-history ol {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  max-height: 260px;
  overflow: auto;
  padding: 0;
}

.action-history li {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: grid;
  gap: 6px;
  padding: 10px;
}

.action-history li div {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.action-history li strong {
  color: var(--ink);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
}

.action-history time {
  color: var(--subtle);
  font-size: var(--fs-caption);
}

.action-history p {
  color: var(--ink);
  font-size: var(--fs-body);
  line-height: 1.45;
  white-space: pre-wrap;
}

.validation-message {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-regular);
  line-height: 1.35;
}

legend {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-size: var(--fs-card-title);
  font-weight: var(--fw-semibold);
  gap: 10px;
  justify-content: space-between;
  padding: 0 6px;
  width: 100%;
}

legend strong {
  color: var(--brand);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
}

.driver-list {
  display: grid;
  gap: 12px;
}

.driver-control {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  display: grid;
  gap: 8px;
  padding: 10px;
  position: relative;
}

.driver-heading {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.driver-heading label {
  color: var(--ink);
  display: block;
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
}

.driver-heading small {
  color: var(--muted);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
}

.info-button {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand);
  display: inline-flex;
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  height: 22px;
  justify-content: center;
  line-height: 1;
  min-width: 22px;
  overflow: hidden;
  padding: 0;
  width: 22px;
}

.info-button .material-icon {
  height: 16px;
  font-size: 16px;
  width: 16px;
}

.info-button:hover,
.info-button:focus-visible {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--panel);
}

.driver-tooltip {
  background: var(--ink);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 24px rgb(30 34 51 / 24%);
  color: var(--panel);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  left: 0;
  line-height: 1.35;
  max-width: min(330px, 80vw);
  opacity: 0;
  padding: 9px 10px;
  pointer-events: none;
  position: absolute;
  top: 28px;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
  visibility: hidden;
  z-index: 5;
}

.info-button:hover ~ .driver-tooltip,
.info-button:focus ~ .driver-tooltip,
.driver-tooltip:hover {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.driver-control input[type="range"] {
  --driver-value: 50;
  --driver-color: var(--brand-2);
  appearance: none;
  background: linear-gradient(90deg, var(--risk-low) 0%, var(--risk-medium) 34%, var(--risk-serious) 67%, var(--risk-high) 100%);
  border: 0;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgb(30 34 51 / 8%);
  height: 10px;
  min-height: 10px;
  padding: 0;
  transition: box-shadow 160ms ease;
}

.driver-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  background: var(--panel);
  border: 2px solid var(--driver-color);
  border-radius: 999px;
  box-shadow: 0 4px 12px rgb(108 92 231 / 18%);
  height: 18px;
  width: 18px;
}

.driver-control input[type="range"]::-moz-range-thumb {
  background: var(--panel);
  border: 2px solid var(--driver-color);
  border-radius: 999px;
  box-shadow: 0 4px 12px rgb(108 92 231 / 18%);
  height: 14px;
  width: 14px;
}

.driver-control output {
  color: var(--driver-color);
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  justify-self: end;
}

.empty-state,
.empty-cell {
  color: var(--muted);
  font-size: var(--fs-body);
  padding: 12px;
}

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

@media (max-width: 1220px) {
  .workspace {
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  }

  .detail-panel {
    grid-column: 1 / -1;
    max-height: none;
    position: static;
  }
}

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

  .metric-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

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

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

  .toolbar {
    justify-content: flex-start;
    width: 100%;
  }
}

@media (max-width: 760px) {
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tr[data-id] {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 10px;
  }

  .table-wrap tr.selected {
    background: var(--panel-strong);
    border-color: rgb(30 34 51 / 14%);
  }

  .table-wrap td {
    align-items: start;
    border-bottom: 0;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(98px, 0.42fr) minmax(0, 1fr);
    padding: 6px 0;
  }

  .table-wrap td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: var(--fs-overline);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.5px;
    text-transform: uppercase;
  }

  .table-wrap td:first-child {
    display: block;
    padding-top: 0;
  }

  .table-wrap td:first-child::before {
    display: none;
  }

  .level-pill {
    justify-self: start;
  }
}

.notification-button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--brand);
  display: inline-flex;
  height: 38px;
  justify-content: center;
  min-width: 38px;
  padding: 0;
  position: relative;
  width: 38px;
}

.notification-button:hover,
.notification-button:focus-visible {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.notification-badge {
  align-items: center;
  background: var(--danger-bg);
  border: 2px solid var(--panel);
  border-radius: var(--radius-pill);
  color: var(--red);
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 800;
  height: 18px;
  justify-content: center;
  line-height: 1;
  min-width: 18px;
  padding: 0 5px;
  position: absolute;
  right: -4px;
  top: -4px;
}

@media (max-width: 560px) {
  .workspace {
    padding: 10px;
  }

  .metric-grid,
  .form-grid,
  .score-strip {
    grid-template-columns: 1fr;
  }

  .distribution-toggle {
    grid-template-columns: 1fr;
  }

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

  .priority-band-meter {
    grid-column: 1 / -1;
  }

  .toolbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(38px, auto));
  }

  .text-button {
    grid-column: 1 / -1;
  }

  .risk-map-shell {
    grid-template-rows: 260px auto auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes panel-attention {
  0%,
  100% {
    box-shadow: var(--shadow);
  }

  35% {
    box-shadow: 0 0 0 4px rgb(108 92 231 / 12%), var(--shadow);
  }
}
