:root {
  color-scheme: dark;
  --bg: #080b10;
  --bg-elevated: #0d1118;
  --panel: #111720;
  --panel-strong: #161d28;
  --panel-soft: #0b1017;
  --line: #27303d;
  --line-soft: #1b2430;
  --text: #f2f5f7;
  --text-muted: #9da8b5;
  --text-dim: #7d8b99;
  --accent: #b8f455;
  --accent-strong: #94d82d;
  --accent-soft: rgba(184, 244, 85, 0.1);
  --cyan: #5ed6d2;
  --purple: #a88cff;
  --orange: #ffad5c;
  --red: #ff7373;
  --blue: #6aa6ff;
  --good: #55d58b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 11px;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f1;
  --bg-elevated: #fcfcf8;
  --panel: #ffffff;
  --panel-strong: #f1f3ed;
  --panel-soft: #f7f8f4;
  --line: #d7ddd2;
  --line-soft: #e7eae3;
  --text: #17201e;
  --text-muted: #5f6b68;
  --text-dim: #64706d;
  --accent: #467608;
  --accent-strong: #335a00;
  --accent-soft: rgba(70, 118, 8, 0.09);
  --cyan: #087f7b;
  --purple: #6d4ec7;
  --orange: #b45f06;
  --red: #c63d3d;
  --blue: #316ccb;
  --good: #1d7d4a;
  --shadow: 0 24px 70px rgba(48, 57, 49, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 74% -10%, rgba(112, 92, 221, 0.09), transparent 35%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

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

button,
select,
input[type="radio"],
input[type="checkbox"],
summary {
  cursor: pointer;
}

button {
  border: 0;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  transform: translateY(-150%);
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  padding: 9px 13px;
  font-weight: 700;
  transition: transform 150ms ease;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  height: 68px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  padding: 0 22px;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.brand small {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 11px;
}

.status-pill,
.diagnostic-badge,
.fit-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text-muted);
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
  color: var(--text-muted);
  transition: border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.icon-button:hover {
  border-color: var(--text-dim);
  color: var(--text);
  transform: translateY(-1px);
}

.theme-icon {
  font-size: 18px;
  line-height: 1;
}

.app-shell {
  display: grid;
  min-height: calc(100vh - 68px);
  grid-template-columns: minmax(310px, 370px) minmax(0, 1fr);
}

.control-rail {
  position: relative;
  z-index: 5;
  border-right: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
}

.control-rail form {
  position: sticky;
  top: 68px;
  max-height: calc(100vh - 68px);
  overflow-y: auto;
  padding: 30px 28px 24px;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

.rail-heading {
  margin-bottom: 26px;
}

.eyebrow,
.section-number {
  margin: 0 0 9px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.rail-heading h1 {
  margin: 0;
  font-size: clamp(24px, 2.4vw, 30px);
  font-weight: 620;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.rail-heading > p:last-child {
  margin: 11px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.control-group {
  margin: 0 0 21px;
  border: 0;
  padding: 0;
}

.control-group > legend,
.legend-row legend,
.field-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.control-group > legend,
.legend-row {
  margin-bottom: 9px;
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.text-button {
  background: transparent;
  color: var(--accent);
  padding: 2px;
  font-size: 10px;
  font-weight: 650;
}

.segment-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-soft);
  padding: 4px;
}

.segment-control label {
  position: relative;
}

.segment-control input {
  position: absolute;
  opacity: 0;
}

.segment-control span {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.segment-control input:checked + span {
  background: var(--panel-strong);
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.1);
  color: var(--text);
}

.segment-control input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.phase-fields {
  margin: 0 0 21px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.unit-tag {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
}

.number-field {
  display: flex;
  height: 43px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.number-field:focus-within {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--line));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.number-field input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0 11px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 650;
  appearance: textfield;
}

.number-field input::-webkit-inner-spin-button,
.number-field input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.number-field > span {
  min-width: 42px;
  border-left: 1px solid var(--line-soft);
  color: var(--text-dim);
  padding: 0 9px;
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
}

.field-help {
  margin: 6px 1px 0;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.45;
}

.two-column-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-group {
  position: relative;
}

.choice-group > legend {
  margin-bottom: 9px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.choice-grid {
  display: grid;
  gap: 6px;
}

.hardware-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sharding-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-option {
  position: relative;
  min-width: 0;
}

.choice-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-option > span {
  position: relative;
  display: flex;
  min-height: 58px;
  min-width: 0;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 9px;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.choice-option > span::after {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border: 1px solid var(--line);
  border-radius: 50%;
  content: "";
}

.choice-option:hover > span {
  border-color: var(--line);
  transform: translateY(-1px);
}

.choice-option input:checked + span {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: var(--accent-soft);
}

.choice-option input:checked + span::after {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.choice-option input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.choice-option strong {
  overflow: hidden;
  max-width: 100%;
  padding-right: 8px;
  font-family: var(--mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-option small {
  overflow: hidden;
  max-width: 100%;
  margin-top: 3px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-option > span {
  min-height: 96px;
  align-items: center;
  padding: 4px;
}

.parallel-pair {
  display: grid !important;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.parallel-dimension {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--panel-strong);
}

.parallel-dimension small {
  margin: 0;
  font-size: 6px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.parallel-dimension strong {
  margin-top: 1px;
  padding: 0;
  font-size: 10px;
}

.choice-option input:checked + .parallel-pair .parallel-dimension {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line-soft));
  background: color-mix(in srgb, var(--accent) 7%, var(--panel-strong));
}

.compact-option > span::after {
  display: none;
}

.choice-option.is-partial > span,
.choice-option.is-unavailable > span {
  border-style: dashed;
}

.choice-option.is-partial > span {
  border-color: color-mix(in srgb, var(--orange) 35%, var(--line-soft));
}

.choice-option.is-unavailable > span {
  border-color: color-mix(in srgb, var(--red) 32%, var(--line-soft));
}

.choice-option.is-unavailable input:checked + span {
  border-color: color-mix(in srgb, var(--red) 58%, var(--line));
  background: color-mix(in srgb, var(--red) 7%, var(--panel-soft));
}

.sharding-help {
  margin-top: 7px;
}

.sharding-help[data-state="warning"] {
  color: var(--orange);
}

.sharding-help[data-state="error"] {
  color: var(--red);
}

.auto-calculate-note {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 2px 0 14px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-error {
  margin: -4px 0 10px;
  border: 1px solid color-mix(in srgb, var(--red) 35%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--red) 8%, transparent);
  color: var(--red);
  padding: 8px 10px;
  font-size: 10px;
}

.rail-footnote {
  margin: 10px 8px 0;
  color: var(--text-dim);
  font-size: 9px;
  line-height: 1.4;
  text-align: center;
}

.report-shell {
  min-width: 0;
}

.loading-state,
.error-state {
  display: flex;
  min-height: calc(100vh - 68px);
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 40px;
}

.loading-state > div:last-child,
.error-state > div:last-child {
  display: flex;
  max-width: 440px;
  flex-direction: column;
}

.loading-state strong,
.error-state strong {
  font-size: 17px;
}

.loading-state span,
.error-state p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.loader-orbit {
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.loader-orbit::before,
.loader-orbit::after {
  position: absolute;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  content: "";
}

.loader-orbit::before { inset: 7px; }
.loader-orbit::after { inset: 14px; background: var(--accent); border: 0; }

.loader-orbit span {
  position: absolute;
  top: -3px;
  left: 18px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  transform-origin: 4px 25px;
  animation: orbit 1.1s linear infinite;
}

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

.error-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--red) 40%, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--red) 8%, transparent);
  color: var(--red);
  font-family: var(--mono);
  font-weight: 800;
}

.report {
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: clamp(30px, 5vw, 72px) clamp(22px, 5vw, 74px) 0;
}

.report-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 42px;
}

.report-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.report-header h2 {
  margin: 0;
  font-size: clamp(35px, 5vw, 60px);
  font-weight: 570;
  letter-spacing: -0.06em;
  line-height: 1;
}

.report-header p {
  margin: 13px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.report-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 9px;
}

.secondary-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text-muted);
  padding: 0 12px;
  font-size: 10px;
  font-weight: 650;
  transition: border-color 150ms ease, color 150ms ease;
}

.secondary-button:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.report-section {
  border-top: 1px solid var(--line);
  padding: 46px 0 58px;
}

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

.section-heading h3 {
  margin: 0;
  font-size: clamp(23px, 2.5vw, 32px);
  font-weight: 610;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.section-heading > div > p:last-child {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.heading-with-control {
  align-items: flex-end;
}

.select-label select {
  min-width: 190px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: var(--panel-soft);
  padding: 0 30px 0 11px;
  font-family: var(--mono);
  font-size: 10px;
}

.comparison-cards {
  display: grid;
  grid-template-columns: repeat(var(--comparison-columns, 3), minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.comparison-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--panel), var(--panel-soft));
  padding: 19px;
}

.comparison-card.fastest {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: linear-gradient(145deg, var(--accent-soft), var(--panel-soft) 58%);
}

.comparison-card.does-not-fit {
  border-color: color-mix(in srgb, var(--red) 42%, var(--line));
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--red) 7%, var(--panel)),
    var(--panel-soft)
  );
}

.comparison-card.capacity-unknown {
  border-color: color-mix(in srgb, var(--orange) 38%, var(--line));
}

.comparison-card::after {
  position: absolute;
  right: -15%;
  bottom: -60%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--card-color, var(--accent)) 10%, transparent), transparent 67%);
  content: "";
  pointer-events: none;
}

.card-system-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.system-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.system-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--card-color, var(--accent));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--card-color, var(--accent)) 11%, transparent);
}

.system-name strong {
  font-size: 12px;
}

.winner-badge {
  border-radius: 999px;
  background: var(--accent);
  color: #101608;
  padding: 3px 7px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.capacity-warning-badge,
.capacity-unknown-badge {
  border: 1px solid color-mix(in srgb, var(--red) 45%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--red) 9%, transparent);
  color: var(--red);
  padding: 3px 7px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.capacity-unknown-badge {
  border-color: color-mix(in srgb, var(--orange) 45%, var(--line));
  background: color-mix(in srgb, var(--orange) 9%, transparent);
  color: var(--orange);
}

.card-latency {
  position: relative;
  z-index: 1;
  margin: 23px 0 5px;
  font-family: var(--mono);
  font-size: clamp(28px, 3vw, 41px);
  font-weight: 520;
  letter-spacing: -0.065em;
  line-height: 1;
}

.card-latency small {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0;
}

.card-subline {
  position: relative;
  z-index: 1;
  color: var(--text-muted);
  font-size: 10px;
}

.card-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 20px 0 0;
  border-top: 1px solid var(--line-soft);
  padding-top: 13px;
}

.card-metrics div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.card-metrics dt {
  color: var(--text-dim);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-metrics dd {
  overflow: hidden;
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 13px;
  text-align: left;
  white-space: nowrap;
}

.data-table thead th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: var(--panel-strong);
  color: var(--text-dim);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.data-table tbody tr:last-child > td {
  border-bottom: 0;
}

.data-table tbody tr:not(.operation-detail-row):hover {
  background: color-mix(in srgb, var(--panel-strong) 55%, transparent);
}

.data-table .numeric {
  text-align: right;
}

.data-table td.numeric,
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.comparison-system {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
}

.resource-chip,
.path-chip,
.bottleneck-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--text-muted);
  padding: 3px 7px;
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.resource-chip.compute,
.bottleneck-chip.compute { border-color: color-mix(in srgb, var(--purple) 35%, var(--line)); color: var(--purple); }
.resource-chip.hbm,
.bottleneck-chip.hbm { border-color: color-mix(in srgb, var(--cyan) 35%, var(--line)); color: var(--cyan); }
.resource-chip.communication,
.bottleneck-chip.communication { border-color: color-mix(in srgb, var(--orange) 35%, var(--line)); color: var(--orange); }
.resource-chip.critical_path { border-color: color-mix(in srgb, var(--blue) 35%, var(--line)); color: var(--blue); }
.resource-chip.unknown,
.bottleneck-chip.unknown { border-color: var(--line); color: var(--text-muted); }

.certificate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.breakdown-grid,
.memory-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(310px, 0.75fr);
  gap: 12px;
}

.chart-card,
.manifest-content {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  padding: 19px;
}

.card-heading,
.memory-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.card-heading h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 680;
}

.card-heading p {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 9px;
  line-height: 1.45;
}

.card-heading > strong {
  font-family: var(--mono);
  font-size: 14px;
  white-space: nowrap;
}

.stacked-bar {
  display: flex;
  height: 32px;
  overflow: hidden;
  margin: 26px 0 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.stacked-bar-segment {
  position: relative;
  min-width: 1px;
  height: 100%;
  border-right: 1px solid color-mix(in srgb, var(--bg) 60%, transparent);
  background: var(--segment-color);
  transition: filter 150ms ease, transform 150ms ease;
}

.stacked-bar-segment:hover {
  z-index: 2;
  filter: brightness(1.18);
  transform: scaleY(1.08);
}

.breakdown-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 20px;
}

.legend-item {
  display: grid;
  min-width: 0;
  align-items: center;
  grid-template-columns: 8px 1fr auto;
  gap: 7px;
}

.legend-item i,
.legend-swatch {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--item-color);
}

.legend-item span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-item strong {
  font-family: var(--mono);
  font-size: 9px;
}

.micro-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-strong);
}

.micro-bar i {
  display: block;
  width: var(--bar-width);
  height: 100%;
  border-radius: inherit;
  background: var(--bar-color);
}

.resource-card {
  margin-top: 12px;
}

.diagnostic-badge {
  flex: 0 0 auto;
  border-color: color-mix(in srgb, var(--orange) 30%, var(--line));
  color: var(--orange);
}

.resource-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-top: 23px;
}

.resource-column {
  min-width: 0;
}

.resource-column-head {
  display: grid;
  gap: 5px;
  margin-bottom: 8px;
}

.resource-column-head span {
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.35;
}

.resource-column-head strong {
  font-family: var(--mono);
  font-size: 9px;
}

.resource-track {
  height: 13px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--panel-strong);
}

.resource-track i {
  display: block;
  width: var(--bar-width);
  height: 100%;
  background: var(--bar-color);
}

.certificate-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  border-top: 1px solid var(--line-soft);
  padding-top: 15px;
}

.certificate-total > div {
  display: grid;
  gap: 4px;
}

.certificate-total span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 650;
}

.certificate-total small {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.45;
}

.certificate-total strong {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 14px;
}

.layer-chart-card {
  padding: 16px 16px 10px;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 25px;
  padding: 0 4px 10px;
}

.inline-legend {
  display: flex;
  align-items: center;
  gap: 15px;
}

.inline-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 9px;
}

.legend-swatch {
  display: inline-block;
}

.legend-swatch.embedding { background: var(--text-dim); }
.legend-swatch.kda { background: var(--accent); }
.legend-swatch.mla { background: var(--purple); }
.legend-swatch.compute {
  border-radius: 50%;
  background: var(--purple);
}
.legend-swatch.hbm { background: var(--cyan); }
.legend-swatch.communication {
  border-radius: 0;
  background: var(--orange);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.roofline-card {
  padding: 16px;
}

.roofline-toolbar {
  padding-bottom: 13px;
}

.roofline-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#roofline-summary {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 9px;
}

.roofline-grid {
  display: grid;
  align-items: stretch;
  grid-template-columns: minmax(0, 1fr) minmax(235px, 300px);
  gap: 18px;
}

.roofline-canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 430px;
}

#roofline-chart {
  display: block;
  width: 100%;
  height: 430px;
  cursor: grab;
  touch-action: none;
}

#roofline-chart.is-dragging {
  cursor: grabbing;
}

.roofline-tooltip {
  max-width: 360px;
}

.roofline-side {
  display: grid;
  align-content: start;
  gap: 28px;
  border-left: 1px solid var(--line-soft);
  padding: 12px 2px 8px 18px;
}

.roofline-side h4 {
  margin: 0;
  font-size: 11px;
}

.roofline-side p {
  margin: 5px 0 0;
  color: var(--text-dim);
  font-size: 9px;
  line-height: 1.45;
}

.roofline-topology,
.roofline-boundary-summary,
.roofline-communication-list {
  display: grid;
  gap: 11px;
  margin-top: 15px;
}

.roofline-topology-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 9px;
}

.roofline-topology-row span {
  color: var(--text-muted);
}

.roofline-topology-row strong {
  color: var(--text);
  font-size: 9px;
  text-align: right;
}

.roofline-bound-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 9px;
}

.roofline-bound-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
}

.roofline-bound-row i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--row-color);
}

.roofline-bound-row.compute { --row-color: var(--purple); }
.roofline-bound-row.hbm { --row-color: var(--cyan); }
.roofline-bound-row.communication { --row-color: var(--orange); }

.roofline-communication-row {
  display: grid;
  min-width: 0;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
}

.roofline-communication-row > span:first-child {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roofline-communication-row strong,
.roofline-communication-row small {
  font-family: var(--mono);
  font-size: 8px;
}

.roofline-communication-row > .micro-bar {
  grid-column: 1 / -1;
}

.roofline-communication-row small {
  grid-column: 1 / -1;
  color: var(--text-dim);
}

.roofline-empty {
  margin: 0 !important;
}

.roofline-note {
  margin: 13px 4px 0;
  border-top: 1px solid var(--line-soft);
  color: var(--text-dim);
  padding-top: 11px;
  font-size: 9px;
  line-height: 1.5;
}

#layer-chart-summary {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 9px;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  min-height: 320px;
}

#layer-chart {
  display: block;
  width: 100%;
  height: 320px;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  max-width: 240px;
  transform: translate(-50%, calc(-100% - 12px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  padding: 8px 10px;
  pointer-events: none;
}

.chart-tooltip strong,
.chart-tooltip span {
  display: block;
}

.chart-tooltip strong {
  font-size: 10px;
}

.chart-tooltip span {
  margin-top: 2px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 9px;
}

.table-toolbar {
  display: flex;
  min-height: 55px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 15px;
}

.table-filter {
  display: flex;
  width: min(340px, 100%);
  height: 37px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
  padding: 0 10px;
}

.table-filter > span {
  color: var(--text-dim);
  font-size: 18px;
}

.table-filter input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 10px;
}

.table-filter input::placeholder {
  color: var(--text-dim);
}

.table-key {
  color: var(--text-dim);
  font-size: 9px;
}

kbd {
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--panel-strong);
  padding: 2px 4px;
  font-family: var(--mono);
  font-size: 8px;
}

.layer-table-wrap {
  max-height: 650px;
}

.layer-table {
  min-width: 860px;
}

.layer-row {
  cursor: pointer;
}

.layer-row[aria-expanded="true"] {
  background: color-mix(in srgb, var(--panel-strong) 75%, transparent);
}

.expand-cell {
  width: 35px;
  padding-right: 0 !important;
}

.expand-button {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text-muted);
  font-size: 12px;
  transition: transform 150ms ease, color 150ms ease;
}

.layer-row[aria-expanded="true"] .expand-button {
  color: var(--accent);
  transform: rotate(45deg);
}

.stage-name-cell {
  font-weight: 650;
}

.stage-name-cell small {
  display: block;
  margin-top: 2px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 400;
}

.path-chip.kda { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); color: var(--accent); }
.path-chip.mla { border-color: color-mix(in srgb, var(--purple) 30%, var(--line)); color: var(--purple); }
.path-chip.other { color: var(--text-dim); }

.share-cell {
  min-width: 100px;
}

.share-inline {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.share-inline .micro-bar {
  width: 52px;
}

.operation-detail-row > td {
  background: var(--panel-strong);
  padding: 0 !important;
}

.operation-wrap {
  padding: 14px 15px 18px 47px;
}

.operation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 10px;
}

.operation-head strong {
  font-size: 10px;
}

.operation-head span {
  color: var(--text-dim);
  font-size: 8px;
}

.operation-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.operation-table {
  min-width: 1120px;
  font-size: 9px;
}

.operation-table th,
.operation-table td {
  padding: 8px 9px;
}

.operation-row {
  cursor: pointer;
}

.operation-row.is-expanded {
  background: color-mix(in srgb, var(--accent-soft) 65%, var(--panel));
}

.operation-name {
  max-width: 250px;
  white-space: normal !important;
}

.operation-toggle {
  display: grid;
  width: 100%;
  min-width: 185px;
  align-items: center;
  grid-template-columns: 17px minmax(0, 1fr);
  gap: 5px;
  border-radius: 5px;
  outline: 0;
  background: transparent;
  color: inherit;
  padding: 2px 3px 2px 0;
  text-align: left;
}

.operation-toggle:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}

.operation-chevron {
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1;
  text-align: center;
  transition: color 150ms ease, transform 150ms ease;
}

.operation-toggle[aria-expanded="true"] .operation-chevron {
  color: var(--accent);
  transform: rotate(90deg);
}

.operation-toggle strong,
.operation-toggle small {
  display: block;
}

.operation-toggle small {
  margin-top: 2px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 7px;
}

.operation-calculation-row > td {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--panel) 72%, var(--panel-strong));
  padding: 0 !important;
  white-space: normal;
}

.calculation-trace {
  position: sticky;
  left: 0;
  width: min(1040px, calc(100vw - 445px));
  padding: 15px 17px 18px;
}

.calculation-trace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.calculation-trace-head > div {
  display: flex;
  flex-direction: column;
}

.calculation-trace-head strong {
  font-size: 10px;
}

.calculation-trace-head span {
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 8px;
}

.calculation-count {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.calculation-card {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px 11px;
}

.calculation-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.calculation-card > header > div {
  min-width: 0;
}

.calculation-card > header strong,
.calculation-card > header code {
  display: block;
}

.calculation-card > header strong {
  font-size: 9px;
}

.calculation-card > header code {
  overflow: hidden;
  margin-top: 1px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calculation-shown {
  flex: 0 0 auto;
  border-radius: 4px;
  background: var(--panel-strong);
  color: var(--accent);
  padding: 3px 6px;
  font-family: var(--mono);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.calculation-steps {
  display: grid;
  gap: 5px;
  margin: 0;
}

.calculation-steps > div {
  display: grid;
  min-width: 0;
  align-items: baseline;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 7px;
}

.calculation-steps dt {
  color: var(--text-dim);
  font-size: 7px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.calculation-steps dd {
  min-width: 0;
  margin: 0;
}

.calculation-steps code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.calculation-result code {
  color: var(--text);
  font-weight: 700;
}

.calculation-card > p {
  margin: 8px 0 0 65px;
  border-left: 2px solid var(--line);
  color: var(--text-dim);
  padding-left: 7px;
  font-size: 7px;
  line-height: 1.5;
}

.notes-disclosure {
  min-width: 180px;
}

.notes-button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 8px;
  list-style: none;
}

.notes-button::-webkit-details-marker {
  display: none;
}

.notes-button:hover,
.notes-button:focus-visible,
.notes-disclosure[open] .notes-button {
  border-color: var(--accent);
  color: var(--accent);
}

.notes-list {
  min-width: 220px;
  margin: 8px 0 0;
  padding: 8px 8px 8px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text-muted);
  font-size: 8px;
  line-height: 1.5;
}

.notes-list li + li {
  margin-top: 5px;
}

.table-note,
.memory-caveat {
  margin: 10px 2px 0;
  color: var(--text-dim);
  font-size: 9px;
  line-height: 1.5;
}

.memory-grid {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr);
}

.memory-headline > div {
  display: flex;
  flex-direction: column;
}

.memory-headline span:first-child {
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.memory-headline strong {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: clamp(25px, 3vw, 36px);
  font-weight: 520;
  letter-spacing: -0.05em;
}

.fit-badge.fits {
  border-color: color-mix(in srgb, var(--good) 35%, var(--line));
  color: var(--good);
}

.fit-badge.over {
  border-color: color-mix(in srgb, var(--red) 35%, var(--line));
  color: var(--red);
}

.fit-badge.unknown {
  border-color: color-mix(in srgb, var(--orange) 35%, var(--line));
  color: var(--orange);
}

.capacity-bar {
  position: relative;
  height: 20px;
  overflow: hidden;
  margin-top: 25px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    repeating-linear-gradient(90deg, transparent, transparent calc(25% - 1px), var(--line-soft) 25%),
    var(--panel-strong);
}

.capacity-bar > span {
  display: block;
  width: var(--capacity-width);
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.capacity-bar.over > span {
  background: linear-gradient(90deg, var(--orange), var(--red));
}

.capacity-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 8px;
}

.memory-components {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.memory-component {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-left: 2px solid var(--item-color);
  padding-left: 9px;
}

.memory-component span {
  overflow: hidden;
  color: var(--text-dim);
  font-size: 8px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.memory-component strong {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 10px;
}

.weight-list {
  display: grid;
  gap: 11px;
  margin-top: 20px;
}

.weight-row {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(95px, 0.85fr) minmax(90px, 1fr) 66px;
  gap: 10px;
}

.weight-row > span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weight-row > strong {
  font-family: var(--mono);
  font-size: 8px;
  text-align: right;
}

.manifest-content {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.7fr);
  gap: 30px;
}

.manifest-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--line-soft);
}

.manifest-fact {
  display: flex;
  min-height: 72px;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  background: var(--panel-strong);
  padding: 12px;
}

.manifest-fact span {
  color: var(--text-dim);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.manifest-fact strong {
  overflow: hidden;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manifest-side h4 {
  margin: 0 0 12px;
  font-size: 10px;
}

.manifest-side code {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--accent);
  padding: 9px;
  font-family: var(--mono);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-list {
  display: grid;
  gap: 7px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.source-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
  font-size: 8px;
  text-decoration: none;
}

.source-list a:hover {
  color: var(--text);
}

.source-list a span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-list a span:last-child {
  color: var(--accent);
}

.report-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 25px;
  border-top: 1px solid var(--line);
  padding: 33px 0 48px;
}

.report-footer strong {
  font-size: 11px;
}

.report-footer p {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 9px;
}

.report-footer a {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  text-decoration: none;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .control-rail form {
    padding-right: 22px;
    padding-left: 22px;
  }

  .comparison-cards {
    grid-template-columns: 1fr;
  }

  .comparison-card {
    display: grid;
    align-items: center;
    grid-template-columns: 0.8fr 1fr 1fr;
    gap: 16px;
  }

  .card-latency {
    margin: 0;
  }

  .card-subline {
    display: none;
  }

  .card-metrics {
    margin: 0;
    border-top: 0;
    padding-top: 0;
  }

  .breakdown-grid,
  .memory-grid {
    grid-template-columns: 1fr;
  }

  .manifest-content {
    grid-template-columns: 1fr;
  }

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

  .roofline-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
    border-top: 1px solid var(--line-soft);
    border-left: 0;
    padding: 18px 4px 8px;
  }

  .calculation-trace {
    width: min(760px, calc(100vw - 375px));
  }

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

@media (max-width: 820px) {
  .site-header {
    height: 60px;
    padding: 0 14px;
  }

  .status-pill {
    display: none;
  }

  .brand small {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .control-rail {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .control-rail form {
    position: static;
    display: grid;
    max-height: none;
    overflow: visible;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
    padding: 28px 20px;
  }

  .rail-heading,
  .hardware-group,
  .sharding-group,
  .form-error,
  .auto-calculate-note,
  .rail-footnote {
    grid-column: 1 / -1;
  }

  .control-group,
  .phase-fields {
    margin-bottom: 18px;
  }

  .report {
    padding: 40px 20px 0;
  }

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

  .report-meta {
    align-items: flex-start;
  }

  .resource-bars {
    grid-template-columns: repeat(2, 1fr);
  }

  .manifest-facts {
    grid-template-columns: repeat(2, 1fr);
  }

  .operation-wrap {
    padding-left: 12px;
  }

  .calculation-trace {
    width: calc(100vw - 54px);
  }
}

@media (max-width: 560px) {
  .number-field input,
  .select-label select,
  .table-filter input {
    font-size: 16px;
  }

  .control-rail form {
    display: block;
  }

  .comparison-card {
    display: block;
  }

  .card-latency {
    margin: 23px 0 5px;
  }

  .card-subline {
    display: block;
  }

  .card-metrics {
    margin-top: 20px;
    border-top: 1px solid var(--line-soft);
    padding-top: 13px;
  }

  .heading-with-control {
    align-items: flex-start;
    flex-direction: column;
  }

  .select-label,
  .select-label select {
    width: 100%;
  }

  .breakdown-legend {
    grid-template-columns: 1fr;
  }

  .resource-bars {
    grid-template-columns: 1fr;
  }

  .roofline-toolbar,
  .roofline-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .roofline-side {
    grid-template-columns: 1fr;
  }

  .roofline-canvas-wrap {
    min-height: 360px;
  }

  .table-key {
    display: none;
  }

  .calculation-trace {
    width: calc(100vw - 46px);
    padding: 12px;
  }

  .calculation-trace-head > div > span {
    max-width: 230px;
  }

  .calculation-card > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .calculation-steps > div {
    grid-template-columns: 1fr;
    gap: 1px;
  }

  .calculation-card > p {
    margin-left: 0;
  }

  .memory-components {
    grid-template-columns: 1fr;
  }

  .weight-row {
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 6px 10px;
  }

  .weight-row > span:first-child {
    grid-column: 1;
    grid-row: 1;
    font-size: 10px;
    white-space: normal;
  }

  .weight-row > .micro-bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .weight-row > strong {
    grid-column: 2;
    grid-row: 1;
    font-size: 10px;
  }

  .manifest-facts {
    grid-template-columns: 1fr;
  }

  .report-footer {
    flex-direction: column;
  }
}

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

@media print {
  :root {
    color-scheme: light;
    --bg: #fff;
    --bg-elevated: #fff;
    --panel: #fff;
    --panel-strong: #f5f5f5;
    --panel-soft: #fff;
    --line: #bbb;
    --line-soft: #ddd;
    --text: #111;
    --text-muted: #444;
    --text-dim: #666;
  }

  .site-header,
  .control-rail,
  .loading-state,
  .error-state,
  .report-meta button,
  #roofline-reset,
  .select-label,
  .table-toolbar,
  .expand-cell {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .report {
    width: 100%;
    padding: 20px;
  }

  .report-section {
    break-inside: avoid;
  }

  .layer-table-wrap {
    max-height: none;
    overflow: visible;
  }
}
