:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --surface: #fff;
  --ink: #242c29;
  --muted: #737770;
  --line: #e4e5dd;
  --accent: #b94028;
  --accent-soft: #fff5ef;
  --green: #387157;
  --red: #b53732;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 3px solid #bc6545; outline-offset: 4px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 30; padding: 12px 20px; background: var(--ink); color: white; }
.skip-link:focus { top: 12px; }
.topbar { min-height: 82px; padding: 16px max(28px, calc((100vw - 1256px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #fcfbf8; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 750; letter-spacing: -.02em; }
.brand b { font-weight: 500; margin-left: 7px; }
.brand small { display: block; font-size: 10px; letter-spacing: .14em; font-weight: 500; color: var(--muted); margin-top: 2px; }
.top-actions { display: flex; gap: 28px; align-items: center; font-size: 12px; }
.server-state { display: flex; align-items: center; gap: 8px; color: var(--green); }
.server-state i, .metric-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); display: inline-block; }
.server-state.connecting { color: var(--muted); }
.server-state.connecting i { background: #a3a79d; }
.server-state.offline { color: var(--red); }
.server-state.offline i { background: var(--red); }
.home-link { padding: 8px 0 8px 25px; border-left: 1px solid var(--line); }
.home-link span { margin-left: 12px; }
.home-link:hover { color: var(--accent); }
main { width: min(1256px, calc(100% - 56px)); margin: 0 auto; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 38px 0 29px; }
.eyebrow { font: 600 10px/1.4 ui-monospace, monospace; letter-spacing: .13em; color: var(--accent); margin-bottom: 12px; }
h1 { font-size: clamp(27px, 3vw, 37px); line-height: 1.35; letter-spacing: -.035em; font-weight: 650; }
h1 > span { color: var(--accent); }
.intro-copy { margin-top: 10px; color: var(--muted); font-size: 13px; }
.access-badge { flex-shrink: 0; display: flex; align-items: center; gap: 8px; background: #eeefe6; border: 1px solid #dfe3d5; border-radius: 30px; padding: 8px 12px; font-size: 11px; color: #59664e; }
.access-badge > span { font-weight: 700; }
.connection-alert { color: #952b25; background: #fff0ee; border: 1px solid #e9b7af; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 25px; padding: 17px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metrics > div { display: flex; gap: 10px; align-items: center; padding: 0 24px; border-left: 1px solid var(--line); }
.metrics > div:first-child { padding-left: 0; border-left: 0; }
.metrics > div > span:not(.metric-dot) { color: var(--muted); font-size: 12px; }
.metrics strong { margin-left: auto; font: 600 22px/1.2 ui-monospace, monospace; color: var(--ink); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.primary-column, .side-column { display: grid; gap: 22px; min-width: 0; }
.panel { padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.step-heading { display: flex; align-items: flex-start; gap: 12px; }
.step-number { border: 1px solid var(--line); border-radius: 8px; width: 33px; height: 33px; display: grid; place-items: center; color: var(--accent); background: #faf9f5; font: 500 12px ui-monospace, monospace; flex-shrink: 0; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.step-heading p { font-size: 11px; color: var(--muted); margin-top: 4px; }
.button { min-height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 7px; background: white; font-size: 12px; font-weight: 550; transition: background .15s, border-color .15s; white-space: nowrap; }
.button:hover:not(:disabled) { background: #f6f5ef; border-color: #c4c7bc; }
.button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button.primary:hover:not(:disabled) { background: #a13520; border-color: #a13520; }
.library-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.segmented { display: inline-flex; background: #f4f4ef; padding: 3px; border-radius: 7px; }
.segmented button { background: transparent; border: 0; padding: 6px 13px; font-size: 11px; color: var(--muted); border-radius: 5px; }
.segmented button.active { color: var(--ink); background: white; box-shadow: 0 1px 4px #222b2210; font-weight: 600; }
.library-note { color: #83877f; font: 10px ui-monospace, monospace; }
.firmware-list { display: grid; gap: 10px; }
.firmware-card { position: relative; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.firmware-card:hover { border-color: #c2c6ba; }
.firmware-card.selected { background: var(--accent-soft); border-color: #c85d42; }
.firmware-select { display: grid; grid-template-columns: 17px 43px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 15px; cursor: pointer; }
.firmware-select input, .device-check { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.firmware-icon { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 8px; background: #f0f1e9; color: #566650; font: 650 11px ui-monospace, monospace; }
.firmware-card.selected .firmware-icon { background: #f3dfd1; color: #974329; }
.firmware-info { min-width: 0; }
.firmware-name { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.firmware-name strong { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.source-label { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; font-weight: 400; }
.firmware-info small { display: block; color: var(--muted); font-size: 11px; margin-top: 5px; overflow-wrap: anywhere; }
.firmware-meta { display: grid; justify-items: end; gap: 5px; font-size: 11px; white-space: nowrap; }
.firmware-meta b { font-weight: 500; }
.tag { font-size: 10px; display: inline-flex; border-radius: 4px; padding: 3px 6px; color: var(--muted); background: #f0f1ec; }
.tag.good { color: #387157; background: #edf3ed; }
.tag.warn { color: #896021; background: #fbf0dd; }
.firmware-extra { display: flex; justify-content: space-between; gap: 12px; padding: 0 15px 12px 99px; color: var(--muted); font-size: 11px; }
.text-button { border: 0; padding: 0; background: transparent; font-size: 11px; color: var(--accent); }
.text-button:hover { text-decoration: underline; }
.device-note { font-size: 12px; color: var(--muted); line-height: 1.8; margin: -7px 0 17px; }
.device-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.device-card { border: 1px solid var(--line); padding: 16px; border-radius: 9px; min-width: 0; }
.device-card.selected { border-color: #c85d42; background: var(--accent-soft); }
.device-top { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.device-title { min-width: 0; flex: 1; }
.device-title strong { display: block; font-size: 13px; font-weight: 600; }
.device-title small { display: block; font-size: 10px; margin-top: 3px; overflow-wrap: anywhere; color: var(--muted); }
.device-build { padding: 10px 0; margin: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.device-build span { display: block; font-size: 11px; overflow-wrap: anywhere; }
.device-build small { display: block; font-size: 10px; color: var(--muted); margin-top: 4px; }
.device-signals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.signal { text-align: center; font-size: 10px; }
.signal b { font-weight: 500; display: block; }
.signal span { color: var(--muted); font-size: 10px; }
.signal.good span { color: var(--green); }
.signal.bad span { color: var(--red); }
.device-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; }
.device-actions .button { min-height: 32px; font-size: 11px; padding: 5px 8px; }
.empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 150px; padding: 24px 16px; background: #fafbf7; border: 1px dashed #dce0d4; border-radius: 8px; color: var(--muted); font-size: 12px; }
.empty-symbol { width: 38px; height: 38px; border-radius: 10px; background: #eef0e7; display: grid; place-items: center; font-size: 23px; color: #7c8870; margin-bottom: 12px; }
.empty strong { color: #555e50; font-size: 13px; font-weight: 500; }
.empty p { margin-top: 7px; font-size: 11px; line-height: 1.8; max-width: 310px; }
.empty .text-button { margin-top: 12px; }
.launch-panel { padding: 25px; background: #29342e; border-radius: 12px; color: #fbfaf5; }
.launch-panel .step-number { background: #38473e; border-color: #596b5d; color: #d2d9bf; }
.launch-panel .step-heading p { color: #b1bcae; }
.selection-summary { margin: 24px 0; }
.selection-summary > div { display: flex; gap: 16px; justify-content: space-between; margin: 14px 0; font-size: 12px; }
.selection-summary dt { color: #acb9a9; flex-shrink: 0; }
.selection-summary dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.selection-summary dd.mono { font-size: 10px; padding-top: 2px; }
.launch-panel .button { width: 100%; min-height: 45px; display: flex; justify-content: space-between; padding-inline: 16px; font-size: 13px; background: #cb5237; border-color: #cb5237; }
.launch-panel .button:disabled { opacity: 1; color: #a0ad9c; border-color: #4a594e; background: #3c4b40; }
.launch-panel .button:hover:not(:disabled) { background: #b7432a; }
.launch-hint { text-align: center; color: #c5d1bf; font-size: 11px; margin-top: 11px; }
.launch-note { color: #a3b09f; font-size: 11px; line-height: 1.9; border-top: 1px solid #435045; margin-top: 22px; padding-top: 17px; }
.activity-panel { padding: 20px; }
.activity-panel .panel-heading { margin-bottom: 16px; }
.activity-panel h2 { font-size: 15px; }
.live-badge { color: var(--green); font-size: 10px; }
.live-badge::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: middle; }
.compact-empty { min-height: 150px; }
.job-list { display: grid; gap: 10px; max-height: 420px; overflow: auto; }
.job-card { background: #fafbf7; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.job-card.selected { border-color: #8c9d82; }
.job-select { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 13px; }
.job-select > span { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.job-select strong { font-size: 12px; font-weight: 600; }
.job-select small { font-size: 10px; color: var(--muted); }
.job-port { display: block; font-size: 10px; color: var(--muted); overflow-wrap: anywhere; margin-top: 7px; }
.job-progress { width: 100%; height: 4px; display: block; margin: 12px 0 8px; accent-color: var(--green); border: 0; background: #e4e7dd; border-radius: 8px; overflow: hidden; }
.job-progress::-webkit-progress-bar { background: #e4e7dd; }
.job-progress::-webkit-progress-value { background: var(--green); }
.job-progress::-moz-progress-bar { background: var(--green); }
.job-card.error .job-progress::-webkit-progress-value { background: var(--red); }
.job-foot { color: var(--muted); font-size: 11px; }
.job-error { margin: 0 13px 12px; color: var(--red); font-size: 11px; overflow-wrap: anywhere; }
.job-cancel { margin: 0 13px 12px; }
.log-details { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.log-details summary { cursor: pointer; font-size: 12px; color: #58634f; }
.log-details summary > span { float: right; font-size: 10px; color: var(--muted); padding-top: 2px; }
.console-head { display: flex; justify-content: space-between; gap: 8px; padding: 13px 0 9px; }
.console-head > span { min-width: 0; font-size: 10px; color: var(--muted); overflow-wrap: anywhere; }
.console-head .text-button { flex-shrink: 0; }
.console { height: 240px; margin: 0; padding: 12px; background: #212c25; color: #d0d9c8; border-radius: 6px; font: 11px/1.8 ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; }
footer { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); margin-top: 35px; padding: 22px 0 30px; color: var(--muted); font-size: 10px; }
.footer-divider { margin-inline: 12px; color: #b5b8af; }
dialog { width: min(510px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #fff; box-shadow: 0 25px 90px #16221830; }
dialog::backdrop { background: #1b251e66; backdrop-filter: blur(4px); }
.dialog-card { padding: 27px; }
.dialog-head { display: flex; justify-content: space-between; gap: 16px; }
.dialog-head h2 { font-size: 22px; }
.icon-button { width: 32px; height: 32px; background: transparent; border: 1px solid var(--line); border-radius: 6px; font-size: 22px; }
.dialog-copy { color: var(--muted); font-size: 12px; margin-top: 12px; }
.drop-zone { min-height: 220px; padding: 18px; margin-top: 22px; background: #f8f9f4; border: 1px dashed #bdc8b6; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; position: relative; cursor: pointer; }
.drop-zone.drag { background: var(--accent-soft); border-color: var(--accent); }
.drop-zone:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.drop-zone input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.drop-zone strong { font-size: 13px; font-weight: 500; }
.drop-zone > span:not(.upload-icon), .drop-zone small { color: var(--muted); font-size: 11px; }
.upload-icon { width: 42px; height: 42px; margin-bottom: 6px; display: grid; place-items: center; background: #e9ede0; border-radius: 50%; color: #687a59; font-size: 23px; }
.file-preview { margin-top: 15px; padding: 12px 14px; border-radius: 7px; background: #f3f5ec; font-size: 12px; overflow-wrap: anywhere; }
.file-preview small { color: var(--muted); display: block; margin-top: 4px; }
.form-error { color: var(--red); font-size: 12px; margin-top: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 15px); opacity: 0; pointer-events: none; max-width: min(480px, calc(100% - 32px)); width: max-content; padding: 13px 20px; background: #26372c; color: #fff; border-radius: 8px; font-size: 13px; box-shadow: 0 10px 30px #17251920; transition: opacity .2s, transform .2s; z-index: 40; white-space: pre-line; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1120px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; }
  .panel, .launch-panel { padding: 20px; }
  .device-grid { grid-template-columns: 1fr; }
  .firmware-select { gap: 9px; grid-template-columns: 17px 38px minmax(0, 1fr) auto; padding: 12px; }
  .firmware-icon { width: 38px; height: 38px; }
  .firmware-extra { padding-left: 85px; }
  .library-note { display: none; }
}
@media (max-width: 850px) {
  .workspace { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: 1fr 1fr; align-items: start; }
  .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intro { padding-top: 28px; }
  .access-badge { font-size: 10px; }
}
@media (max-width: 600px) {
  main { width: calc(100% - 32px); }
  .topbar { padding: 15px 16px; min-height: 73px; gap: 10px; }
  .brand { font-size: 15px; gap: 8px; }
  .brand img { width: 29px; height: 29px; }
  .brand small { font-size: 9px; }
  .brand b { margin-left: 3px; }
  .top-actions { flex-direction: column-reverse; gap: 4px; align-items: flex-end; font-size: 11px; }
  .home-link { border-left: 0; padding: 0; }
  .home-link span { margin-left: 5px; }
  .server-state { font-size: 9px; gap: 5px; }
  .intro { align-items: flex-start; flex-direction: column; gap: 15px; padding: 25px 0 22px; }
  .eyebrow { font-size: 9px; margin-bottom: 10px; }
  .intro-copy { font-size: 12px; }
  .access-badge { padding: 5px 9px; }
  .metrics { padding: 13px 0; margin-bottom: 18px; }
  .metrics > div { padding: 0 8px; display: grid; gap: 5px; }
  .metrics strong { margin: 0; font-size: 22px; }
  .metrics > div > span:not(.metric-dot) { font-size: 10px; }
  .metrics .metric-dot { display: none; }
  .panel, .launch-panel { padding: 17px; border-radius: 10px; }
  .primary-column, .side-column { gap: 18px; }
  .side-column, .device-grid { grid-template-columns: 1fr; }
  .panel-heading { gap: 8px; margin-bottom: 19px; }
  .step-heading { gap: 9px; }
  .step-heading p { font-size: 10px; }
  .step-number { width: 29px; height: 29px; font-size: 11px; border-radius: 6px; }
  h2 { font-size: 16px; }
  .button { font-size: 11px; padding-inline: 10px; min-height: 38px; }
  .firmware-select { grid-template-columns: 16px 35px minmax(0, 1fr); padding: 12px; gap: 9px; }
  .firmware-icon { width: 35px; height: 35px; font-size: 10px; }
  .firmware-info small { font-size: 10px; }
  .firmware-meta { grid-column: 3; display: flex; justify-content: flex-start; gap: 10px; font-size: 10px; }
  .firmware-extra { padding-left: 80px; flex-wrap: wrap; font-size: 10px; }
  .firmware-name strong { font-size: 12px; }
  .device-note { font-size: 11px; }
  .device-title small { font-size: 11px; }
  footer { flex-direction: column; gap: 6px; margin-top: 24px; }
  .dialog-card { padding: 20px; }
  .dialog-actions .button { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
