:root {
  color-scheme: dark;
  --ink: #ffffff;
  --muted: #aaaaaa;
  --panel: #1b1b1b;
  --canvas: #131313;
  --line: #393939;
  --accent: #7b133c;
  --accent-dark: #9c2252;
  --accent-bright: #af1b5a;
  --warn: #d2b55b;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #111111;
  color: var(--ink);
}

html.windows-ui-scale body {
  zoom: 0.8;
  min-height: 125vh;
}

::selection {
  background: var(--accent-bright);
  color: #ffffff;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: clamp(16px, 3vw, 36px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 18px;
  max-width: 1440px;
  margin: 0 auto;
}

.panel,
.summary-panel,
.sensor-stage,
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-rail {
  display: grid;
  position: sticky;
  top: 24px;
  align-self: start;
  gap: 14px;
}

.controls {
  align-self: start;
  padding: 22px;
}

.viewer-mode-panel {
  padding: 16px;
}

.viewer-mode-title {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
}

.viewer-mode-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 0.86fr 1.38fr;
  gap: 0;
  border: 1px solid var(--accent-bright);
  border-radius: 6px;
  overflow: hidden;
}

.viewer-mode-button {
  box-sizing: border-box;
  min-height: 52px;
  border: 0;
  background: #222222;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.1;
  overflow: visible;
  padding: 0 7px;
  white-space: nowrap;
  transition: background-color 160ms ease, color 160ms ease;
}

.viewer-mode-button[data-viewer-mode="frameleader"] {
  font-size: 0.74rem;
}

.viewer-mode-button + .viewer-mode-button {
  border-left: 1px solid var(--accent-bright);
}

.viewer-mode-button.is-active {
  background: var(--accent);
  color: #ffffff;
}

.viewer-mode-button:hover,
.viewer-mode-button:focus-visible {
  background: var(--accent-dark);
  color: #ffffff;
  outline: none;
}

.viewer-mode-description {
  margin: 13px 2px 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.45;
}

.brand-block {
  margin-bottom: 22px;
}

.brand-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.database-meta {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.manual-link {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  padding: 7px 10px;
  border: 1px solid rgba(210, 181, 91, 0.38);
  border-radius: 6px;
  color: var(--warn);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.language-link {
  border-color: #4a4a4a;
  color: #dcdcdc;
}

.manual-link:hover,
.manual-link:focus-visible {
  background: var(--warn);
  border-color: var(--warn);
  color: #111111;
  outline: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--warn);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.03;
  letter-spacing: 0;
}

.product-title {
  color: var(--ink);
  font-size: clamp(2.325rem, 4.5vw, 3.525rem);
}

.product-title span {
  color: var(--accent-bright);
}

.step-group,
.search-field {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

select,
input[type="search"],
input[type="number"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #222222;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input[type="text"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #222222;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.controls select {
  font-size: calc(1rem - 2px);
}

select:focus,
input:focus {
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px rgba(175, 27, 90, 0.25);
}

input[type="number"]:disabled {
  border-color: #303030;
  background: #171717;
  color: #666666;
  cursor: not-allowed;
  opacity: 1;
}

.divider {
  height: 1px;
  margin: 20px 0;
  background: var(--line);
}

.inline-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.source-resolution-inputs[hidden],
#modeField[hidden] {
  display: none;
}

input[type="range"] {
  accent-color: var(--accent);
}

output {
  color: var(--ink);
  font-weight: 800;
}

.output {
  display: grid;
  gap: 18px;
  min-width: 0;
}

body.is-frameleader-mode .output {
  gap: 12px;
}

.summary-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 116px;
  padding: 14px 20px;
}

.summary-data {
  flex: 1 1 auto;
  min-width: 0;
}

.summary-panel h2 {
  margin: 0 0 3px;
  font-size: clamp(1.22rem, 2.1vw, 1.8rem);
  letter-spacing: 0;
}

.summary-panel p {
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 700;
}

dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

dl div {
  border-left: 3px solid var(--accent-bright);
  padding-left: 9px;
}

dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

dd {
  margin: 2px 0 0;
  font-size: 0.95rem;
  font-weight: 900;
}

.summary-brand {
  display: grid;
  place-items: center;
  flex: 0 0 184px;
  height: 90px;
  border-left: 1px solid var(--line);
  padding-left: 20px;
}

.summary-brand img {
  display: block;
  width: 150px;
  height: auto;
  object-fit: contain;
}

.summary-brand a {
  display: block;
  color: inherit;
}

.sensor-stage {
  padding: clamp(16px, 2vw, 24px);
  overflow: hidden;
}

.frameleader-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

body.is-frameleader-mode .frameleader-fields {
  padding: 12px 14px;
}

.frameleader-fields[hidden] {
  display: none;
}

.sensor-canvas {
  --source-ratio: 1.77;
  position: relative;
  width: min(100%, 940px);
  aspect-ratio: var(--source-ratio);
  max-height: 62vh;
  min-height: 260px;
  margin: 0 auto;
  border: 2px solid #4c4c4c;
  background: linear-gradient(135deg, #101010, #242124 52%, #28131c);
}

.sensor-canvas.is-frameleader {
  overflow: hidden;
  border-color: #ff4b4b;
  background: #ffffff;
}

.frameleader-chart,
.frameleader-safety-zone,
.frameleader-main-frame,
.frameleader-crop-guide,
.frameleader-center-mark,
.frameleader-star,
.frameleader-tick,
.frameleader-format-note,
.frameleader-adl-logo,
.frameleader-title,
.frameleader-center-copy,
.frameleader-bottom-copy,
.frameleader-project-copy,
.frameleader-brand,
.frameleader-source-label,
.frameleader-safety-note {
  position: absolute;
  pointer-events: none;
}

.frameleader-chart {
  inset: 0;
  overflow: hidden;
  background: #444444;
  color: #111111;
}

.frameleader-chart::before {
  content: none;
}

.frameleader-main-frame {
  top: var(--frame-top);
  left: var(--frame-left);
  z-index: 3;
  width: var(--frame-width);
  height: var(--frame-height);
  border: 1px solid #b00000;
  background: #dedede;
}

.frameleader-safety-zone {
  top: var(--safety-top);
  left: var(--safety-left);
  z-index: 2;
  width: var(--safety-width);
  height: var(--safety-height);
  background: #b8b8b8;
}

.frameleader-center-mark {
  top: 50%;
  left: 50%;
  z-index: 12;
  width: clamp(10px, 1.25vw, 18px);
  height: clamp(10px, 1.25vw, 18px);
  transform: translate(-50%, -50%);
}

.frameleader-center-mark::before,
.frameleader-center-mark::after {
  position: absolute;
  background: #ff6c6c;
  content: "";
}

.frameleader-center-mark::before {
  top: 50%;
  left: -50%;
  width: 200%;
  height: 1px;
}

.frameleader-center-mark::after {
  top: -50%;
  left: 50%;
  width: 1px;
  height: 200%;
}

.frameleader-star {
  z-index: 6;
  width: var(--corner-star-size);
  min-width: 58px;
  max-width: 155px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: repeating-conic-gradient(#000000 0deg 7deg, transparent 7deg 14deg);
  transform: translate(-50%, -50%);
}

.frameleader-star::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #000000;
  transform: translate(-50%, -50%);
  content: "";
}

.frameleader-star.is-top-left { top: var(--corner-top-y); left: var(--corner-left-x); }
.frameleader-star.is-top-right { top: var(--corner-top-y); left: var(--corner-right-x); }
.frameleader-star.is-bottom-left { top: var(--corner-bottom-y); left: var(--corner-left-x); }
.frameleader-star.is-bottom-right { top: var(--corner-bottom-y); left: var(--corner-right-x); }

.frameleader-format-note {
  top: 1.1%;
  left: 3.8%;
  z-index: 9;
  margin: 0;
  color: #3bb273;
  font-size: clamp(0.55rem, 1.04vw, 0.92rem);
  font-weight: 700;
  line-height: 1;
}

.frameleader-adl-logo {
  top: calc(var(--frame-top) + 6.4%);
  left: 50%;
  z-index: 10;
  width: clamp(27px, 4.25vw, 59px);
  height: auto;
  opacity: 0.5;
  transform: translateX(-50%);
}

.frameleader-title {
  top: 36.2%;
  left: 50%;
  z-index: 10;
  display: grid;
  justify-items: center;
  transform: translateX(-50%);
  color: #111111;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.frameleader-title strong {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.72rem, 1.55vw, 1.42rem);
  font-weight: 700;
  line-height: 1;
}

.frameleader-title .is-dop {
  margin-top: 0.38em;
  font-size: clamp(0.36rem, 0.78vw, 0.71rem);
}

.frameleader-title span {
  font-size: clamp(0.55rem, 1.28vw, 1.15rem);
  font-weight: 500;
}

.frameleader-center-copy {
  top: 52%;
  left: 50%;
  z-index: 10;
  display: grid;
  justify-items: center;
  transform: translateX(-50%);
  color: #111111;
  font-size: clamp(0.35rem, 0.62vw, 0.58rem);
  font-weight: 500;
  line-height: 1.28;
  text-align: center;
  white-space: nowrap;
}

.frameleader-center-copy b {
  font-weight: 700;
}

.frameleader-bottom-copy {
  top: 57.8%;
  left: 50%;
  z-index: 10;
  display: grid;
  justify-items: center;
  transform: translateX(-50%);
  color: #111111;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}

.frameleader-bottom-copy b {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.58rem, 1.18vw, 1.05rem);
  font-weight: 700;
}

.frameleader-bottom-copy span {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.46rem, 0.92vw, 0.82rem);
  font-weight: 600;
}

.frameleader-project-copy {
  top: 82%;
  left: 50%;
  z-index: 10;
  display: grid;
  justify-items: center;
  transform: translateX(-50%);
  color: #111111;
  font-size: clamp(0.42rem, 0.85vw, 0.74rem);
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.frameleader-tick {
  z-index: 8;
  width: 0;
  height: 0;
  border: clamp(7px, 0.9vw, 12px) solid transparent;
}

.frameleader-crop-guide {
  top: var(--crop-top);
  left: var(--crop-left);
  z-index: 7;
  width: var(--crop-width);
  height: var(--crop-height);
  border: 1px dashed rgba(150, 150, 150, 0.35);
}

.frameleader-crop-guide span {
  position: absolute;
  top: -1.3em;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(130, 130, 130, 0.72);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.36rem, 0.68vw, 0.62rem);
  font-weight: 600;
  white-space: nowrap;
}

.frameleader-crop-guide i {
  position: absolute;
  width: clamp(14px, 3vw, 34px);
  height: clamp(14px, 3vw, 34px);
  border-color: #ff4b4b;
  border-style: solid;
  content: "";
}

.frameleader-crop-guide .is-tl { top: 0; left: 0; border-width: 1px 0 0 1px; }
.frameleader-crop-guide .is-tr { top: 0; right: 0; border-width: 1px 1px 0 0; }
.frameleader-crop-guide .is-bl { bottom: 0; left: 0; border-width: 0 0 1px 1px; }
.frameleader-crop-guide .is-br { right: 0; bottom: 0; border-width: 0 1px 1px 0; }

.frameleader-source-label {
  top: 50%;
  z-index: 8;
  margin: 0;
  color: #f2f2f2;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.58rem, 1.2vw, 1.05rem);
  font-weight: 700;
  white-space: nowrap;
}

.frameleader-source-label.is-left {
  left: 3.2%;
  transform: translate(-50%, -50%) rotate(-90deg);
}

.frameleader-source-label.is-right {
  right: 3.2%;
  transform: translate(50%, -50%) rotate(90deg);
}

.frameleader-safety-note {
  right: calc(var(--frame-left) + 2%);
  bottom: calc(var(--frame-top) + 1.2%);
  z-index: 10;
  margin: 0;
  color: #b00000;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.36rem, 0.68vw, 0.58rem);
  font-weight: 700;
  white-space: nowrap;
}

.frameleader-brand {
  bottom: calc(100% - var(--frame-top) - var(--frame-height) + 6.4%);
  left: 50%;
  z-index: 10;
  margin: 0;
  transform: translateX(-50%);
  color: rgba(120, 120, 120, 0.52);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.5rem, 1.26vw, 1.13rem);
  font-weight: 500;
  white-space: nowrap;
}

.frameleader-tick.is-top-a,
.frameleader-tick.is-top-b,
.frameleader-tick.is-top-c {
  top: var(--tick-top);
  border-top: 0;
  border-bottom-color: #b00000;
  transform: translate(-50%, 28%);
}

.frameleader-tick.is-bottom-a,
.frameleader-tick.is-bottom-b,
.frameleader-tick.is-bottom-c {
  top: var(--tick-bottom);
  border-top-color: #b00000;
  border-bottom: 0;
  transform: translate(-50%, -128%);
}

.frameleader-tick.is-left-a,
.frameleader-tick.is-left-b {
  left: var(--tick-left);
  border-right-color: #b00000;
  border-left: 0;
  transform: translate(28%, -50%);
}

.frameleader-tick.is-right-a,
.frameleader-tick.is-right-b {
  left: var(--tick-right);
  border-right: 0;
  border-left-color: #b00000;
  transform: translate(-128%, -50%);
}

.frameleader-tick.is-top-a,
.frameleader-tick.is-bottom-a { left: var(--tick-x-a); }
.frameleader-tick.is-top-b,
.frameleader-tick.is-bottom-b { left: var(--tick-x-b); }
.frameleader-tick.is-top-c,
.frameleader-tick.is-bottom-c { left: var(--tick-x-c); }
.frameleader-tick.is-left-a,
.frameleader-tick.is-right-a { top: var(--tick-y-a); }
.frameleader-tick.is-left-b,
.frameleader-tick.is-right-b { top: var(--tick-y-b); }

.source-box,
.output-window-box,
.editing-format-box,
.delivery-box,
.active-box {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 0;
  pointer-events: none;
}

.source-box {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid #3bb273;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    rgba(59, 178, 115, 0.1);
  background-size: 28px 28px, 28px 28px, auto;
  z-index: 2;
}

.source-box.is-full-size {
  border: 1px solid #3bb273;
}

.source-box.is-editing-source {
  z-index: 4;
}

.source-box.is-out-of-range {
  border-color: #d13b50;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    rgba(209, 59, 80, 0.13);
}

.output-window-box {
  top: 50%;
  left: 50%;
  z-index: 1;
  transform: translate(-50%, -50%);
  border: 1px solid #0d0e0f;
}

.output-window-box i {
  position: absolute;
  display: block;
  background: rgba(0, 0, 0, 0.7);
}

.output-window-box.is-wide i {
  top: 0;
  bottom: 0;
  width: var(--window-overhang);
}

.output-window-box.is-wide i:first-child {
  left: 0;
}

.output-window-box.is-wide i:last-child {
  right: 0;
}

.output-window-box.is-tall i {
  right: 0;
  left: 0;
  height: var(--window-overhang);
}

.output-window-box.is-tall i:first-child {
  top: 0;
}

.output-window-box.is-tall i:last-child {
  bottom: 0;
}

.editing-format-box {
  top: 50%;
  left: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  border: 2px solid #278bd8;
  background: rgba(39, 139, 216, 0.08);
}

.delivery-box {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid var(--accent-bright);
  background: rgba(123, 19, 60, 0.13);
  z-index: 2;
}

.active-box {
  top: 50%;
  left: 50%;
  z-index: 6;
  transform: translate(-50%, -50%);
  border: 2px dashed var(--warn);
  background: rgba(210, 181, 91, 0.1);
}

.sensor-canvas.is-fdl {
  position: relative;
  display: flex;
  align-items: center;
  width: min(100%, 1050px);
  aspect-ratio: 16 / 9;
  min-height: 350px;
  padding: clamp(16px, 2vw, 25px) clamp(16px, 2vw, 25px) clamp(38px, 4vw, 44px);
}

.fdl-diagram {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  gap: 12px;
}

.fdl-diagram.is-source-only {
  grid-template-columns: minmax(260px, 0.58fr);
  justify-content: center;
}

.fdl-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.fdl-panel-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
}

.fdl-panel-title b {
  color: #ffffff;
  font-size: 0.72rem;
}

.fdl-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: var(--fdl-ratio);
  border: 1px solid var(--fdl-canvas-color);
  background:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    rgba(0, 0, 0, 0.2);
  background-size: 26px 26px, 26px 26px, auto;
}

.fdl-source-panel {
  --fdl-canvas-color: #3bb273;
}

.fdl-derived-panel {
  --fdl-canvas-color: #278bd8;
}

.fdl-frame-box {
  position: absolute;
  border-radius: 0;
  pointer-events: none;
}

.fdl-protection-box {
  z-index: 2;
  border: 1px dashed rgba(210, 181, 91, 0.62);
  background: rgba(210, 181, 91, 0.04);
}

.fdl-decision-box {
  z-index: 3;
  border: 2px solid #d2b55b;
  background: rgba(210, 181, 91, 0.11);
}

.fdl-panel-details {
  display: grid;
  gap: 5px;
}

.fdl-detail {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #e6e6e6;
  font-size: clamp(0.55rem, 0.78vw, 0.65rem);
  font-weight: 500;
}

.fdl-detail::before {
  width: 3px;
  height: 9px;
  flex: 0 0 3px;
  background: var(--fdl-detail-color);
  content: "";
}

.fdl-detail.canvas {
  --fdl-detail-color: var(--fdl-canvas-color);
}

.fdl-detail.decision {
  --fdl-detail-color: #d2b55b;
}

.fdl-detail.protection {
  --fdl-detail-color: rgba(210, 181, 91, 0.62);
}

.fdl-transform {
  display: grid;
  justify-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.54rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.fdl-transform-line {
  position: relative;
  width: 45px;
  height: 1px;
  background: var(--accent-bright);
}

.fdl-transform-line::after {
  position: absolute;
  top: -4px;
  right: 0;
  width: 8px;
  height: 8px;
  border-top: 1px solid var(--accent-bright);
  border-right: 1px solid var(--accent-bright);
  transform: rotate(45deg);
  content: "";
}

.fdl-transform em {
  padding: 4px 5px;
  border-left: 2px solid var(--accent-bright);
  color: #f0d7e1;
  font-size: 0.57rem;
  font-style: normal;
}

.fdl-validation-note {
  position: absolute;
  bottom: 14px;
  left: clamp(16px, 2vw, 25px);
  margin: 0;
  color: #969696;
  font-size: clamp(0.55rem, 0.75vw, 0.62rem);
  font-weight: 500;
}

.fdl-source-only-note {
  position: absolute;
  right: clamp(16px, 2vw, 25px);
  bottom: 14px;
  z-index: 4;
  margin: 0;
  color: #3bb273;
  font-size: clamp(0.63rem, 0.86vw, 0.73rem);
  font-weight: 700;
  text-align: right;
}

.fdl-import-notice {
  position: absolute;
  top: 50%;
  right: clamp(16px, 2vw, 25px);
  left: clamp(16px, 2vw, 25px);
  z-index: 50;
  transform: translateY(-50%);
  margin: 0;
  padding: 10px 14px;
  border-radius: 4px;
  color: #ffffff;
  font-size: clamp(1.12rem, 1.56vw, 1.32rem);
  font-weight: 800;
  text-align: center;
}

.fdl-import-notice.is-success {
  background: rgba(47, 132, 82, 0.92);
}

.fdl-import-notice.is-warning {
  background: rgba(146, 31, 45, 0.94);
}

.fdl-error {
  display: grid;
  gap: 8px;
  place-items: center;
  max-width: 390px;
  padding: 24px;
  color: var(--text);
  text-align: center;
}

.fdl-error strong {
  color: var(--warn);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.fdl-error p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.visor-label {
  position: absolute;
  z-index: 20;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(17, 17, 17, 0.9);
  color: var(--ink);
  padding: 6px 8px 6px 17px;
  font-size: clamp(0.52rem, 0.91vw, 0.62rem);
  font-weight: 400;
  text-align: center;
}

.visor-label::before {
  position: absolute;
  top: 50%;
  left: 7px;
  width: 3px;
  height: calc(50% - 3px);
  transform: translateY(-50%);
  background: var(--label-marker);
  content: "";
}

.label-source {
  --label-marker: #3bb273;
}

.visor-label.label-source.is-out-of-range {
  --label-marker: #f28394;
  background: #a5223c;
  color: #ffffff;
}

.label-format {
  --label-marker: #278bd8;
  color: #cde9ff;
}

.label-output {
  --label-marker: var(--accent-bright);
}

.label-active {
  --label-marker: var(--warn);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.timeline li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #222222;
  color: #ffffff;
  font-weight: 800;
}

.timeline b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  background: var(--accent);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.stat {
  min-height: 145px;
  padding: 14px;
}

body.is-frameleader-mode .stat {
  min-height: 116px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stat-active-area span {
  color: var(--warn);
}

.stat-editing-format span {
  color: #50a9ed;
}

.stat-fdl-source span {
  color: #3bb273;
}

.stat-fdl-intent span,
.stat-fdl-decision span,
.stat-fdl-protection span {
  color: var(--warn);
}

.stat-fdl-derived span {
  color: #50a9ed;
}

.stat strong {
  display: block;
  margin-top: 12px;
  overflow-wrap: break-word;
  font-size: clamp(1rem, 1.45vw, 1.35rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.stat small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

.stat-actions {
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 10px;
}

.export-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--accent-bright);
  border-radius: 4px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.export-button:hover,
.export-button:focus-visible {
  border-color: #d93375;
  background: var(--accent-dark);
  outline: none;
}

.export-pdf {
  background: #222222;
}

.stat-actions .export-button {
  min-height: 37px;
  font-size: 0.82rem;
}

.export-fdl,
.export-fdl-import {
  border-color: #6c6c6c;
  background: #171717;
}

.export-fdl:hover,
.export-fdl:focus-visible {
  border-color: #50a9ed;
  background: #236b9d;
}

.export-fdl-source {
  border-color: #777777;
  background: #343434;
}

.export-fdl-source:hover,
.export-fdl-source:focus-visible {
  border-color: #3bb273;
  background: #2f8452;
}

.export-fdl-import:hover,
.export-fdl-import:focus-visible {
  border-color: var(--warn);
  background: #ad8a22;
}

@media (max-width: 720px) {
  .viewer-mode-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .viewer-mode-button:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--accent-bright);
  }

  .viewer-mode-button:nth-child(4) {
    border-top: 1px solid var(--accent-bright);
  }

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

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

  .sensor-canvas.is-fdl {
    min-height: 520px;
  }

  .fdl-diagram {
    grid-template-columns: 1fr;
  }

  .fdl-transform {
    grid-auto-flow: column;
    align-items: center;
    justify-content: center;
  }
}

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

  .control-rail {
    position: static;
  }

  .viewer-mode-panel {
    padding: 16px;
  }
}

@media (max-width: 1280px) and (min-width: 1101px) {
  .workspace {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 14px;
  }

  .controls {
    padding: 18px;
  }

  .product-title {
    font-size: clamp(2rem, 3.6vw, 3rem);
  }

  .summary-panel {
    min-height: 104px;
    padding: 12px 16px;
  }

  .summary-brand {
    flex-basis: 150px;
    height: 78px;
    padding-left: 16px;
  }

  .summary-brand img {
    width: 124px;
  }

  .sensor-canvas {
    min-height: 230px;
  }
}

@media (max-height: 1080px) {
  .product-title {
    font-size: clamp(2rem, 3.8vw, 3rem);
  }

  label {
    font-size: 0.84rem;
  }

  .controls select,
  input[type="search"],
  input[type="number"] {
    font-size: 0.86rem;
  }

  .viewer-mode-title {
    font-size: 0.94rem;
  }

  .viewer-mode-button {
    font-size: 0.88rem;
    white-space: normal;
  }

  .viewer-mode-description {
    font-size: 0.79rem;
  }

  .summary-panel h2 {
    font-size: clamp(1.1rem, 1.75vw, 1.55rem);
  }

  .summary-panel p {
    font-size: 0.88rem;
  }

  dt {
    font-size: 0.68rem;
  }

  dd {
    font-size: 0.88rem;
  }

  .timeline li {
    font-size: 0.88rem;
  }

  .stat span {
    font-size: 0.72rem;
  }

  .stat strong {
    font-size: clamp(0.94rem, 1.25vw, 1.16rem);
  }

  .stat small {
    font-size: 0.78rem;
  }
}

@media (max-height: 760px) and (min-width: 1101px) {
  .app-shell {
    padding: 14px;
  }

  .control-rail {
    position: static;
    gap: 10px;
  }

  .controls {
    padding: 16px;
  }

  .brand-block {
    margin-bottom: 14px;
  }

  .database-meta {
    margin-top: 8px;
  }

  .step-group,
  .search-field {
    gap: 10px;
  }

  .divider {
    margin: 14px 0;
  }

  .viewer-mode-panel {
    padding: 13px;
  }

  .viewer-mode-title {
    margin-bottom: 10px;
  }

  .viewer-mode-button {
    min-height: 44px;
  }

  .viewer-mode-description {
    margin-top: 10px;
    line-height: 1.35;
  }

  .product-title {
    font-size: clamp(1.9rem, 3.4vw, 2.75rem);
  }

  select,
  input[type="search"],
  input[type="number"] {
    min-height: 38px;
    padding-inline: 10px;
  }

  label {
    gap: 5px;
    font-size: 0.82rem;
  }

  .summary-panel {
    min-height: 92px;
    padding: 10px 14px;
  }

  .summary-panel h2 {
    font-size: clamp(1.05rem, 1.65vw, 1.45rem);
  }

  .summary-panel p {
    margin-bottom: 7px;
    font-size: 0.84rem;
  }

  dt {
    font-size: 0.66rem;
  }

  dd {
    font-size: 0.84rem;
  }

  .summary-brand {
    flex-basis: 132px;
    height: 70px;
    padding-left: 14px;
  }

  .summary-brand img {
    width: 110px;
  }

  .output {
    gap: 12px;
  }

  .sensor-stage {
    padding: 12px;
  }

  .sensor-canvas {
    max-height: 50vh;
    min-height: 205px;
  }

  .timeline li {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.86rem;
  }

  .timeline b {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
  }

  .stat {
    min-height: 118px;
    padding: 11px;
  }

  .stat strong {
    margin-top: 8px;
    font-size: clamp(0.92rem, 1.15vw, 1.12rem);
  }

  .stat small {
    margin-top: 7px;
    font-size: 0.76rem;
  }
}

@media (max-height: 680px) and (min-width: 1101px) {
  .app-shell {
    padding: 10px;
  }

  .workspace {
    grid-template-columns: minmax(260px, 315px) minmax(0, 1fr);
    gap: 10px;
  }

  .controls {
    padding: 13px;
  }

  .brand-block {
    margin-bottom: 10px;
  }

  .eyebrow {
    margin-bottom: 5px;
    font-size: 0.68rem;
  }

  .database-meta {
    margin-top: 5px;
    font-size: 0.7rem;
  }

  .product-title {
    font-size: clamp(1.7rem, 3vw, 2.35rem);
  }

  .step-group,
  .search-field {
    gap: 8px;
  }

  .divider {
    margin: 10px 0;
  }

  select,
  input[type="search"],
  input[type="number"] {
    min-height: 34px;
    border-radius: 5px;
  }

  .viewer-mode-panel {
    padding: 10px;
  }

  .viewer-mode-title {
    margin-bottom: 7px;
    font-size: 0.88rem;
  }

  .viewer-mode-button {
    min-height: 38px;
    font-size: 0.82rem;
  }

  .viewer-mode-description {
    margin-top: 7px;
    font-size: 0.74rem;
    line-height: 1.28;
  }

  .summary-panel {
    min-height: 78px;
    padding: 8px 12px;
  }

  .summary-brand {
    flex-basis: 112px;
    height: 58px;
  }

  .summary-brand img {
    width: 92px;
  }

  .sensor-canvas {
    max-height: 46vh;
    min-height: 180px;
  }

  .stats-grid {
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .stat {
    min-height: 102px;
    padding: 9px;
  }

  .export-button {
    min-height: 34px;
    font-size: 0.78rem;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 12px;
  }

  .workspace,
  .output,
  .control-rail {
    gap: 12px;
  }

  .controls {
    padding: 16px;
  }

  .brand-block {
    margin-bottom: 14px;
  }

  .product-title {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .step-group,
  .search-field {
    gap: 10px;
  }

  .divider {
    margin: 14px 0;
  }

  .viewer-mode-panel {
    padding: 13px;
  }

  .viewer-mode-button {
    min-height: 44px;
    font-size: 0.86rem;
  }

  .viewer-mode-description {
    margin-top: 10px;
    font-size: 0.78rem;
  }

  .summary-panel {
    min-height: 96px;
    padding: 12px 14px;
  }

  .summary-brand {
    flex-basis: 136px;
    height: 70px;
    padding-left: 14px;
  }

  .summary-brand img {
    width: 112px;
  }

  .sensor-stage {
    padding: 12px;
  }

  .sensor-canvas {
    min-height: 205px;
  }

  .timeline li {
    min-height: 42px;
    padding: 8px 10px;
  }

  .stat {
    min-height: 118px;
    padding: 11px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 10px;
  }

  .controls,
  .summary-panel,
  .sensor-stage,
  .stat {
    box-shadow: none;
  }

  dl,
  .timeline,
  .stats-grid,
  .inline-inputs {
    grid-template-columns: 1fr;
  }

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

  .summary-brand {
    width: 100%;
    height: auto;
    border-top: 1px solid var(--line);
    border-left: 0;
    padding: 14px 0 0;
  }

  .sensor-canvas {
    min-height: 220px;
  }
}
