/* Copyright (C) 2026 DoYitNow. SPDX-License-Identifier: GPL-2.0-only */
:root {
  --bg: #f3f3f2;
  --paper: #fff;
  --ink: #202224;
  --muted: #707477;
  --line: #dedfdf;
  --accent: #282b2d;
  --accent-soft: #f0f1f1;
  --warn: #5e5550;
  --warn-soft: #f4f2ef;
  --danger: #66504a;
  --radius: 5px;
  --font: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 13px/1.55 var(--font); }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; color: #909396; background: #f4f4f4; border-color: #e5e5e5; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid #5b6064;
  outline-offset: 3px;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 17px; font-weight: 600; line-height: 1.45; }
h2 { font-size: 22px; font-weight: 600; line-height: 1.4; }
h3 { font-size: 13px; font-weight: 600; }
small { font-size: 11px; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: #62676b; }
.muted { color: var(--muted); font-size: 11px; }
.eyebrow { margin-bottom: 9px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 1.3px; }
.mono { font-family: Consolas, "SFMono-Regular", monospace; }

.topbar {
  min-height: 72px;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand strong { display: block; font-size: 15px; font-weight: 600; letter-spacing: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions > a.button { text-decoration: none; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
}
.button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.button.support-entry { background: #f7eeeb; border-color: #dec9c1; color: #794b3c; font-weight: 600; }
.button.support-entry:hover { background: #efe0db; border-color: #bb9587; color: #653b2e; }
.button.primary:hover:not(:disabled) { background: #44494c; border-color: #44494c; }
.button.secondary { background: #fff; border-color: #ccced0; color: var(--ink); }
.button.secondary:hover:not(:disabled) { background: #f4f4f3; border-color: #999da0; }
.button.quiet { background: transparent; color: #5c6266; }
.button.quiet:hover:not(:disabled) { background: var(--accent-soft); color: var(--ink); }
.button.small { padding: 6px 9px; font-size: 11px; }
.button.full { width: 100%; }
.button:disabled { background: #f1f1f1; border-color: #e0e1e1; color: #919598; }
.button.quiet:disabled { background: transparent; border-color: transparent; color: #9b9fa1; }
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid #d5d7d8;
  border-radius: 3px;
  background: #fff;
  color: #50565a;
  font-size: 18px;
  line-height: 1;
}
.icon-button:hover:not(:disabled) { background: #f1f2f2; border-color: #999da0; }

.workspace {
  display: grid;
  grid-template-columns: 248px minmax(340px, 1fr) 280px;
  align-items: start;
  gap: 16px;
  max-width: 1520px;
  margin: 0 auto;
  padding: 24px 28px 36px;
}
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.sidebar { display: flex; flex-direction: column; min-height: 640px; }
.source-section { padding: 20px 18px; border-bottom: 1px solid var(--line); }
.source-section h1 { margin-bottom: 6px; overflow-wrap: anywhere; }
.source-section .muted { margin-bottom: 17px; font-size: 11px; }
.source-section > .field-label { margin-top: 16px; }
.function-nav { display: flex; flex-direction: column; gap: 3px; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.function-button { padding: 10px 12px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: #72777a; text-align: left; font-size: 12px; }
.function-button:hover { background: #f6f6f5; color: var(--ink); }
.function-button.active { border-color: #d9dbdc; background: #eceeed; color: var(--ink); font-weight: 600; }
.crop-row { min-height: 55px; }
.crop-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.crop-ratio-inputs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.crop-ratio-inputs > span { color: #5f6468; }
.crop-ratio-inputs .text-input { padding-left: 8px; padding-right: 6px; }
.crop-ratio-inputs .button { padding: 8px 12px; }
.crop-geometry-section { margin-top: 25px; padding-top: 24px; border-top: 1px solid var(--line); }
.crop-frame { display: flex; align-items: center; justify-content: center; width: min(100%, 400px); aspect-ratio: 3 / 2; margin: 0 auto 24px; border: 1px solid #d9dbdc; border-radius: 3px; background: #eceeed; }
.crop-frame > div { max-height: 100%; border: 1px solid #737a7e; background: #bec5c2; }
.shutdown-thumbnail { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 30px; overflow: hidden; border: 1px solid #d8dadb; border-radius: 2px; background: #111; color: #8c9092; font-size: 11px; }
.shutdown-thumbnail img { width: 100%; height: 100%; object-fit: contain; }
.shutdown-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 24px; }
.shutdown-preview { display: grid; place-items: center; width: min(100%, 400px); margin: 0 auto; overflow: hidden; border: 1px solid #d4d6d7; border-radius: 3px; background: #000; }
.shutdown-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.shutdown-preview > p { color: #8b9093; font-size: 12px; }
.shutdown-preview-caption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 7px 16px; max-width: 540px; margin: 10px auto 0; color: #777d81; font-size: 11px; }
.shutdown-preview-caption > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.shutdown-fields { min-width: 0; }
.shutdown-fields .field-help { margin: 8px 0 15px; }
.shutdown-fit-row { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.shutdown-fit-row .field-label { flex-shrink: 0; margin: 0; }
.shutdown-fit-row .text-input { width: auto; max-width: 100%; min-height: 32px; font-size: 11px; }
.shutdown-dialog-upload { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.shutdown-dialog-upload .field-help { margin: 0; overflow-wrap: anywhere; }
.callout.warning { border-color: #ddd7cf; background: var(--warn-soft); color: var(--warn); }
.filter-section { flex: 1; padding: 19px 10px 14px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.section-heading h2 { font-size: 13px; }
.filter-section .section-heading { padding: 0 8px; margin-bottom: 13px; }
.count { margin-left: 5px; color: #858a8d; font-size: 11px; font-weight: 400; font-variant-numeric: tabular-nums; }
.search {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 6px 10px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fafafa;
  color: #858a8d;
}
.search:focus-within { border-color: #858b8e; }
.search span { font-size: 19px; line-height: 1; }
.search input { width: 100%; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--ink); font-size: 11px; }
.search input:focus-visible { outline-offset: 2px; }
.filter-list { display: flex; flex-direction: column; gap: 3px; max-height: 430px; overflow: auto; scrollbar-width: thin; }
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.filter-row:hover { background: #f6f6f5; }
.filter-row.active { border-color: #d9dbdc; background: #eceeed; }
.filter-row.is-hidden { color: #8a8f92; }
.filter-row .filter-label { flex: 1; min-width: 0; }
.filter-row strong { display: block; overflow: hidden; color: inherit; font-size: 12px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.filter-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.filter-visibility { display: inline-flex; width: 12px; height: 12px; margin-left: 4px; vertical-align: -2px; color: currentColor; opacity: .8; }
.filter-visibility svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.filter-row .filter-index { color: #9c9fa1; font-size: 10px; }
.preset-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  overflow: hidden;
  position: relative;
  border: 1px solid #d8dadb;
  border-radius: 3px;
  background: #f1f2f1;
  color: #656a6e;
  font-size: 12px;
  font-weight: 600;
}
.preset-icon img { width: 100%; height: 100%; object-fit: contain; }
.preset-icon.large { width: 72px; height: 72px; border-radius: 4px; background: #f7f7f6; font-size: 25px; }
.list-empty { padding: 28px 10px; color: #85898c; font-size: 11px; text-align: center; }

.editor { min-height: 640px; padding: 25px 26px; }
.editor-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.editor-header > div { min-width: 0; }
.editor-header h2 { overflow-wrap: anywhere; }
.editor-header .muted { margin-top: 5px; }
.editor-header > .button { flex-shrink: 0; }
.identity-section { display: flex; align-items: flex-start; gap: 17px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.identity-fields { flex: 1; min-width: 0; }
.field-label { display: block; margin-bottom: 6px; color: #5f6468; font-size: 11px; font-weight: 500; }
.text-input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #ccced0;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}
.text-input::placeholder { color: #94989b; }
.text-input:disabled { background: #f5f5f4; border-color: #e0e1e1; color: #94989b; }
.field-help { margin-top: 8px; color: #777c80; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 11px; }
.parameter-section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.section-heading > div .muted { margin-top: 4px; font-size: 11px; }
.badge { padding: 3px 6px; border: 1px solid #e0e1e1; border-radius: 3px; font-size: 10px; white-space: nowrap; }
.badge.neutral { background: #f6f6f5; color: #71767a; }
.badge.good { background: #eeefee; color: #4a5054; }
.badge.warning { background: var(--warn-soft); color: var(--warn); }
.parameter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; max-height: clamp(180px, 28vh, 250px); overflow-y: auto; scrollbar-gutter: stable; padding: 2px 8px 2px 2px; overscroll-behavior: contain; }
.parameter-grid:focus-visible { outline: 1px solid var(--line); outline-offset: 3px; }
.parameter-grid::-webkit-scrollbar { width: 6px; }
.parameter-grid::-webkit-scrollbar-thumb { background: #c8cbcc; border-radius: 3px; }
.parameter-item { min-width: 0; }
.parameter-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; color: #555b5f; font-size: 11px; }
.parameter-toggle { flex-shrink: 0; gap: 5px; color: #858a8d; font-size: 9px; font-weight: 400; }
.parameter-toggle .toggle-track { width: 23px; height: 13px; }
.parameter-toggle .toggle-track::before { width: 9px; height: 9px; }
.parameter-toggle input:checked + .toggle-track::before { transform: translateX(10px); }
.parameter-value { padding: 0 5px; border-radius: 2px; background: #eceeee; color: #444a4e; font: 11px/1.8 Consolas, monospace; }
.parameter-default { display: block; min-height: 33px; padding: 8px 0; color: #909598; font-size: 11px; }
.parameter-item input[type="number"] {
  width: 100%;
  min-width: 0;
  min-height: 33px;
  padding: 6px 9px;
  border: 1px solid #d2d4d5;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font: 12px/1.5 Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
.parameter-item input[type="number"]:disabled { background: #f6f6f5; border-color: #e1e2e2; color: #929699; }
.parameter-item input[type="range"] { display: block; width: 100%; height: 3px; margin: 14px 0 11px; accent-color: var(--accent); }
.parameter-item input[type="range"]:disabled { opacity: .45; }
.parameter-description { min-height: 15px; color: #82878b; font-size: 10px; }
.xmp-section { padding: 24px 0; }
.xmp-section .section-heading { margin-bottom: 13px; }
.xmp-section .inline-actions { flex-shrink: 0; justify-content: flex-end; margin-top: 0; }
.render-options { display: flex; align-items: center; gap: 12px; }
.render-options .field-label { margin-bottom: 0; }
.render-options .text-input { width: 150px; min-height: 32px; padding: 6px 9px; font-size: 11px; }
.xmp-section > .field-help { margin: 7px 0 12px; }
.calibration-environment { margin-top: 12px; color: var(--muted); font-size: 11px; }
.calibration-environment summary { width: fit-content; cursor: pointer; }
.calibration-custom-samples { margin-top: 16px; font-size: 12px; }
.calibration-custom-samples summary { width: fit-content; cursor: pointer; color: var(--muted); }
.calibration-custom-samples .button { margin-top: 12px; }
.calibration { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 13px 14px; border: 1px solid #e1e2e2; border-radius: 3px; background: #fafafa; }
.calibration-symbol { display: grid; place-items: center; flex-shrink: 0; width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 3px; background: #fff; color: #777d81; font-size: 13px; }
.calibration strong { display: block; color: #444a4e; font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.calibration p { color: #777c80; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.calibration.warning { background: var(--warn-soft); border-color: #ddd7d0; }
.calibration.warning .calibration-symbol { border-color: #ddd7d0; color: var(--warn); }
.calibration-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 5px; }
.calibration-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; margin: 4px 0; }
.calibration-engine-label { color: var(--muted); font-size: 10px; }
.calibration-step { padding: 3px 6px; border: 1px solid var(--line); border-radius: 3px; color: #777c80; font-size: 10px; }
.calibration-step.complete { background: #eff3ef; border-color: #d8e1d8; color: #4d6652; }
.calibration-metrics { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 5px 0 7px; color: #666e72; font-size: 10px; }
.calibration-previews { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.calibration-previews figure { min-width: 0; margin: 0; }
.calibration-previews a { display: block; }
.calibration-previews img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: contain; border: 1px solid var(--line); border-radius: 3px; background: #eee; }
.calibration-previews figcaption { margin-top: 5px; color: #666e72; font-size: 10px; text-align: center; }
.calibration p.calibration-boundary { font-size: 10px; }
.calibration a { font-size: 11px; }
.calibration-actions { margin-left: auto; }
.status-inline { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 12px; color: #707477; font-size: 11px; font-weight: 400; }
.edit-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 20px; border-top: 1px solid var(--line); }
.toggle { display: flex; align-items: center; gap: 9px; color: #656b6f; font-size: 11px; cursor: pointer; }
.toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle-track { width: 27px; height: 15px; flex-shrink: 0; position: relative; border-radius: 9px; background: #c8cbcd; transition: background .12s; }
.toggle-track::before { content: ""; position: absolute; left: 2px; top: 2px; width: 11px; height: 11px; border-radius: 50%; background: #fff; transition: transform .12s; }
.toggle input:checked + .toggle-track { background: #464b4f; }
.toggle input:checked + .toggle-track::before { transform: translateX(12px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid #5b6064; outline-offset: 3px; }
.toggle input:disabled + .toggle-track { opacity: .45; }
.reorder { display: flex; gap: 6px; }

.project-sidebar { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.project-panel { padding: 20px 18px; }
.project-panel .eyebrow { margin-bottom: 16px; }
.save-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 11px; }
.save-row .muted { font-size: 11px; }
.save-row .unsaved { color: #5a5050; }
.save-row .button { flex-shrink: 0; }
.divider { height: 1px; margin: 20px 0; background: var(--line); }
.project-panel h3 { margin-bottom: 15px; }
.version-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.version-label .muted { font-size: 10px; font-weight: 400; }
.capability-summary { padding: 13px 0 4px; }
.capability-summary > p { padding: 3px 0; color: #70767a; font-size: 11px; }
.capability-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; color: #7b8084; font-size: 11px; }
.capability-row span:last-child { color: #4e5559; text-align: right; }
.capability-row.unavailable span:last-child { color: #85898c; }
.build-note { margin: 7px 0 14px; color: #7c8185; font-size: 11px; line-height: 1.6; }
.build-result { margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.build-result h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; }
.build-result p { margin-bottom: 11px; color: #7b8185; font-size: 11px; }
.download-links { display: flex; flex-direction: column; gap: 7px; }
.download-links .button { padding: 7px 10px; font-size: 11px; }
.history-panel { padding: 19px 18px; }
.history-panel .section-heading { gap: 8px; margin-bottom: 15px; }
.history-panel h3 { font-size: 13px; }
.history-entry { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; padding: 12px 0; border-bottom: 1px solid #e6e7e7; }
.history-entry:first-child { padding-top: 0; }
.history-entry:last-child { padding-bottom: 0; border-bottom: 0; }
.history-entry strong { display: block; color: #444a4e; font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.history-entry small { color: #878c90; font-size: 11px; }
.history-entry .muted { margin: 3px 0 5px; font-size: 10px; }
.history-entry a { font-size: 11px; }
.history-links { display: flex; flex-shrink: 0; gap: 12px; }
.history-links a { padding: 4px 0; }
.history-overflow { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.history-overflow summary { width: fit-content; color: #6c7377; font-size: 11px; cursor: pointer; }
.history-overflow[open] summary { margin-bottom: 13px; }

.empty-editor { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 588px; padding: 32px 12px; text-align: center; }
.empty-editor-icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 18px; border: 1px solid #e2e4e3; border-radius: var(--radius); background: #fafaf9; color: #9aa0a3; }
.empty-editor-icon svg { width: 32px; height: 32px; }
.empty-editor h2 { color: #62696d; font-size: 16px; font-weight: 500; }
.empty-editor > p { max-width: 300px; margin-top: 9px; color: #858a8d; font-size: 12px; line-height: 1.75; }
.notice { max-width: 1464px; margin: 16px auto 0; padding: 11px 15px; border: 1px solid #d6d9da; border-radius: 3px; background: #eaeceb; color: #4e565b; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.notice.error { border-color: #d7bfba; background: #f5efed; color: var(--danger); }
.notice.warning { border-color: #ddd7cf; background: var(--warn-soft); color: var(--warn); }

.modal { width: min(440px, calc(100vw - 32px)); max-height: 85vh; padding: 24px; border: 1px solid #ccced0; border-radius: 5px; background: #fff; color: var(--ink); }
.modal::backdrop { background: #171b1e55; }
.modal.wide { width: min(660px, calc(100vw - 32px)); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.modal-header h2 { font-size: 19px; }
.support-dialog > p { line-height: 1.8; }
.support-dialog > p + p { margin-top: 14px; }
.support-free { font-weight: 600; }
.support-dialog .modal-header { margin-bottom: 16px; }
.support-dialog .modal-footer { margin-top: 16px; }
.support-code { margin: 16px 0; text-align: center; }
.support-code img { display: block; width: 216px; max-width: 100%; height: auto; margin: 0 auto; }
.support-code figcaption { margin-top: 8px; color: var(--muted); font-size: 11px; }
.support-contact { margin-top: 12px; color: var(--muted); font-size: 11px; }
.modal .field-label { margin-top: 17px; }
.modal-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.callout { margin-top: 16px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 3px; background: #f6f6f5; color: #737a7e; font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; }
.details-content { font-size: 12px; }
.detail-row { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.detail-row span:first-child { color: #7b8287; }
.detail-row span:last-child { overflow-wrap: anywhere; text-align: right; }
.details-content pre { max-height: 340px; margin: 0; padding: 15px; overflow: auto; border: 1px solid #e5e6e6; border-radius: 3px; background: #f8f8f7; font: 11px/1.7 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.check-label { display: flex; align-items: center; gap: 8px; margin-top: 15px; color: #70777c; font-size: 11px; }
.check-label input { accent-color: var(--accent); }
.detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 15px; }
.icon-preview-warning { color: var(--warn); font-size: 11px; }
.busy-overlay { display: grid; place-items: center; position: fixed; inset: 0; z-index: 10; background: #f3f3f2b3; }
.busy-card { min-width: 248px; padding: 25px; border: 1px solid #d4d7d8; border-radius: 5px; background: #fff; text-align: center; }
.busy-card strong { display: block; margin-top: 15px; font-size: 13px; font-weight: 500; }
.busy-card p { margin-top: 6px; color: var(--muted); font-size: 11px; }
.spinner { display: inline-block; width: 22px; height: 22px; border: 2px solid #dfe2e3; border-top-color: #4b5256; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 1440px) {
  .workspace { gap: 20px; padding-top: 28px; }
  .editor { padding: 27px 32px; }
  .parameter-grid { gap: 18px 24px; }
}
@media (max-width: 1100px) {
  .topbar { padding-right: 22px; padding-left: 22px; }
  .workspace { grid-template-columns: 226px minmax(320px, 1fr); gap: 16px; padding: 20px 22px 30px; }
  .project-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-column: 1 / -1; align-items: start; }
  .editor { padding: 24px; }
  .sidebar, .editor { min-height: 610px; }
  .empty-editor { min-height: 560px; }
  .shutdown-layout { grid-template-columns: minmax(0, 1fr); }
  .shutdown-fields { padding-top: 23px; border-top: 1px solid var(--line); }
  .notice { margin-right: 22px; margin-left: 22px; }
}
@media (max-width: 720px) {
  .topbar { min-height: 0; padding: 15px 16px; flex-wrap: wrap; gap: 15px; }
  .brand strong { font-size: 14px; }
  .topbar-actions { flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
  .topbar-actions .button { padding: 7px 9px; font-size: 11px; }
  .workspace { display: flex; flex-direction: column; gap: 14px; padding: 16px 12px 24px; }
  .sidebar, .editor { width: 100%; min-height: 0; }
  .source-section { padding: 18px; }
  .function-nav { flex-direction: row; }
  .function-button { flex: 1; text-align: center; }
  .filter-section { padding: 16px 10px 12px; }
  .filter-list { max-height: 224px; }
  .editor { padding: 22px 18px; }
  .editor-header { gap: 12px; margin-bottom: 21px; }
  .editor-header h2 { font-size: 21px; }
  .identity-section { gap: 14px; }
  .preset-icon.large { width: 62px; height: 62px; font-size: 23px; }
  .parameter-grid { gap: 15px 12px; }
  .parameter-section, .xmp-section { padding: 22px 0; }
  .project-sidebar { display: grid; width: 100%; gap: 14px; }
  .project-panel { padding: 19px 18px; }
  .empty-editor { min-height: 320px; padding: 28px 12px; }
  .notice { margin: 12px 12px 0; }
}
@media (max-width: 480px) {
  .shutdown-fit-row { align-items: flex-start; flex-direction: column; gap: 6px; }
  .shutdown-fit-row .text-input { width: 100%; }
  .shutdown-footer { flex-wrap: wrap; }
  .crop-fields { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .project-sidebar { grid-template-columns: minmax(0, 1fr); }
  .parameter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
  .identity-section { gap: 12px; }
  .preset-icon.large { width: 54px; height: 54px; }
  .inline-actions { gap: 4px; }
  .inline-actions .button { padding: 6px 7px; }
  .xmp-section .section-heading { align-items: flex-start; }
  .xmp-section .inline-actions { gap: 3px; }
  .edit-footer { gap: 8px; }
  .toggle { gap: 7px; font-size: 10px; }
  .modal { padding: 21px 18px; }
}
@media (max-width: 359px) {
  .parameter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; }
}

/* Firmware controls stay in the right rail; history opens in a dialog. */
.more-menu { position: relative; }
.more-menu summary { list-style: none; cursor: pointer; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-actions { position: absolute; top: calc(100% + 8px); right: 0; z-index: 5; display: flex; flex-direction: column; align-items: stretch; min-width: 170px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 6px 18px #20222412; }
.more-actions .button { justify-content: flex-start; white-space: nowrap; }
.workspace { grid-template-columns: 220px minmax(0, 1fr) 280px; max-width: 1520px; }
.firmware-rail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.firmware-rail > .panel { flex-shrink: 0; padding: 20px; }
.firmware-rail h2 { margin-bottom: 18px; font-size: 13px; }
.source-summary { display: block; }
.source-summary h1 { font-size: 20px; }
.source-summary .muted { display: block; margin-top: 5px; overflow-wrap: anywhere; }
.source-summary > .mono { margin-top: 10px; }
.source-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.editor { display: flex; flex-direction: column; }
.editor > #editor-content, .editor > #crop-editor, .editor > #shutdown-editor { flex: 1; }
.build-panel { margin: 0; }
.build-controls { display: flex; flex-direction: column; align-items: stretch; gap: 18px; }
.build-version-field { width: 100%; min-width: 0; }
.build-actions { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.build-option { justify-content: flex-start; }
.build-actions .save-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; }
.build-actions .save-row .muted { white-space: nowrap; }
.build-result { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.build-result > strong { margin-right: auto; font-size: 12px; }
.build-panel .build-result { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.build-panel .build-result > strong { width: 100%; }
.baseline-card { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 4px; background: #fafafa; text-align: left; }
.baseline-card:hover { border-color: #93989b; background: #f2f3f2; }
.baseline-card .field-label { margin: 0 0 2px; }
.baseline-card strong { font-size: 17px; font-weight: 600; }
.baseline-card > span { max-width: 100%; overflow-wrap: anywhere; }
.baseline-card .baseline-open { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 10px; color: #555d61; font-size: 11px; }
.empty-editor > .button + .button { margin-top: 10px; }
.history-modal { width: min(960px, calc(100vw - 32px)); max-height: calc(100dvh - 64px); overflow-y: auto; }
.history-modal[open], .history-panel { display: flex; flex-direction: column; min-height: 0; }
.history-modal #history-list { min-height: 0; overflow-y: auto; }
.history-heading, .history-modal #history-result { flex-shrink: 0; }
.history-modal #history-result { margin-bottom: 16px; }
.modal > .notice { position: sticky; top: 0; right: auto; left: auto; z-index: 2; margin: 0 0 16px; }
.history-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; background: var(--paper); }
.history-heading-actions { display: flex; align-items: center; gap: 10px; }
.history-heading .eyebrow { margin-bottom: 5px; }
.history-group + .history-group { margin-top: 28px; }
.history-group-heading { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 3px; background: #f6f7f6; }
.history-group-heading h2 { font-size: 13px; }
.history-record { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 10px; padding: 17px 14px; border: 1px solid var(--line); border-radius: 4px; }
.history-record.current { border-color: #8b9295; background: #f6f7f6; }
.history-info { flex: 1; min-width: 0; }
.history-info p { margin-top: 4px; overflow-wrap: anywhere; }
.history-record-title { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.history-record-title h3 { font-size: 14px; }
.history-record-open { padding: 0; border: 0; background: transparent; color: inherit; font-weight: 600; text-align: left; }
.history-record-open:hover { text-decoration: underline; text-underline-offset: 3px; }
.history-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
.history-actions .button { white-space: nowrap; }
.history-detail-fields { margin: 0 0 22px; }
.history-detail-field { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.history-detail-field dt { color: var(--muted); font-size: 11px; }
.history-detail-field dd { margin: 0; overflow-wrap: anywhere; font-size: 12px; }
.rollback-summary { display: flex; flex-direction: column; gap: 13px; margin-bottom: 18px; }
.rollback-summary > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.rollback-summary span { flex-shrink: 0; color: var(--muted); font-size: 11px; }
.rollback-summary strong { overflow-wrap: anywhere; text-align: right; font-size: 12px; font-weight: 500; }
.risk-summary { margin-bottom: 12px; line-height: 1.8; }
.export-support { width: 100%; margin-top: 14px; }
.export-support > p { margin-bottom: 9px; }
.export-free-notice { margin-top: 16px; }
.risk-footer { justify-content: space-between; align-items: center; }
.risk-footer > .inline-actions:last-child { margin-left: auto; }
.risk-ack { display: flex; align-items: flex-start; gap: 9px; margin-top: 22px; font-size: 12px; }
.risk-ack input { flex-shrink: 0; margin-top: 3px; }
.terms-document { width: min(820px, calc(100% - 32px)); margin: 32px auto; padding: 36px 40px; }
.terms-document h1 { font-size: 26px; }
.terms-version { margin-top: 8px; color: var(--muted); font-size: 11px; }
.terms-clauses { margin-top: 24px; padding-left: 24px; }
.terms-clauses li { padding-left: 4px; line-height: 1.9; }
.terms-clauses li + li { margin-top: 18px; }
@media (min-width: 721px) and (min-height: 520px) {
  html:has(#editor-workspace:not([hidden])) { overflow: hidden; }
  .workspace { height: calc(100dvh - 72px); grid-template-rows: minmax(0, 1fr); align-items: stretch; padding-bottom: 24px; }
  .sidebar, .editor { min-height: 0; overflow: hidden; }
  .firmware-rail { min-height: 0; overflow-y: auto; padding-right: 3px; }
  .function-nav { flex-shrink: 0; }
  .filter-section { display: flex; flex-direction: column; min-height: 0; }
  .filter-section > .section-heading, .filter-section > .search { flex-shrink: 0; }
  .filter-list { flex: 1; min-height: 0; max-height: none; }
  .editor > #editor-content, .editor > #crop-editor, .editor > #shutdown-editor { min-height: 0; overflow-y: auto; padding-right: 10px; }
  .empty-editor { flex: 1; min-height: 0; }
  .notice { position: fixed; top: 78px; right: 28px; left: 28px; z-index: 6; margin: 0; }
}
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 170px minmax(0, 1fr) 220px; gap: 12px; }
  .editor { padding: 22px; }
  .firmware-rail > .panel { padding: 16px; }
  .crop-fields { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .topbar { gap: 12px; }
  .terms-document { margin-top: 18px; padding: 24px 20px; }
  .terms-document h1 { font-size: 23px; }
  .workspace { display: flex; }
  .firmware-rail { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); order: -1; gap: 12px; }
  .source-summary { grid-column: 1 / -1; }
  .history-modal { padding: 20px 16px; }
  .history-record { align-items: flex-start; flex-direction: column; gap: 12px; padding: 16px 4px; }
  .history-actions { justify-content: flex-start; }
  .history-heading { gap: 12px; margin-bottom: 22px; }
  .history-group-heading { flex-wrap: wrap; gap: 3px 10px; }
  .build-actions { gap: 12px; }
  .build-actions .save-row { gap: 9px; }
  .build-actions .save-row .muted { font-size: 10px; }
}
@media (max-width: 480px) {
  .firmware-rail { grid-template-columns: minmax(0, 1fr); }
  .history-detail-field { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .function-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 721px) and (max-height: 800px) {
  .firmware-rail { gap: 12px; }
  .firmware-rail > .panel { padding: 15px; }
  .firmware-rail h2 { margin-bottom: 10px; }
  .source-actions { margin-top: 12px; }
  .build-controls { gap: 12px; }
  .build-actions { gap: 10px; }
  .baseline-card { gap: 3px; padding: 10px; }
  .baseline-card .baseline-open { margin-top: 6px; }
}
/* Public firmware status markers kept alongside the research UI. */
.function-button:disabled { background: transparent; color: #8b9093; cursor: default; opacity: 1; }
.function-pending { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.feature-pending { padding: 2px 6px; border: 1px solid #dfe1e2; border-radius: 3px; background: #f3f4f4; font-size: 10px; font-weight: 400; line-height: 1.4; white-space: nowrap; }

body{background:var(--product-bg);color:var(--product-ink)}
.product-topbar .button.quiet{color:#d7dad6}.product-topbar .button.quiet:hover{background:#323532;color:#fff}
.workspace.product-workspace{display:grid;grid-template-columns:248px minmax(420px,1fr) 286px;gap:18px;max-width:1560px;margin:0 auto;padding:24px clamp(18px,3vw,42px) 40px}
.panel.product-panel{border-color:var(--product-line);border-radius:var(--product-radius);background:var(--product-paper);box-shadow:var(--product-shadow)}
.function-nav{padding:10px;gap:4px}.function-button{border-radius:7px;padding:11px 12px}.function-button.active{border-color:transparent;background:#e7e5de}
.button{border-radius:7px}.button.primary{background:#252826;border-color:#252826}.button.primary:hover:not(:disabled){background:#3a3e3b;border-color:#3a3e3b}
.source-summary,.build-panel,.history-summary{padding:20px}.editor{padding:26px 28px}.filter-section{padding:18px 10px}.source-summary h2,.build-panel h2,.history-summary h2{font-size:12px}
@media(max-width:1040px){.workspace.product-workspace{grid-template-columns:210px minmax(0,1fr)}.firmware-rail{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:720px){.workspace.product-workspace{display:block;padding:14px}.workspace.product-workspace>*+*{margin-top:14px}.sidebar{min-height:auto}.function-nav{display:flex;overflow-x:auto}.function-button{flex:0 0 auto}.firmware-rail{display:grid;grid-template-columns:1fr}.editor{padding:21px 18px}}
