:root {
  color-scheme: light;
  --slate: #151d2b;
  --slate-ink: #f2f5fc;
  --slate-quiet: #c3cddd;
  --page: #edf1f6;
  --surface: #fbfcfe;
  --surface-raised: #f4f7fc;
  --surface-muted: #e7edf6;
  --ink: #19263a;
  --quiet: #526177;
  --outline: rgb(35 57 91 / 15%);
  --outline-strong: rgb(35 57 91 / 25%);
  --blue: #244bd0;
  --blue-hover: #1a3bb1;
  --blue-well: #eaf0ff;
  --blue-ink: #f7f9ff;
  --good: #216248;
  --warn: #805319;
  --warn-well: #f7ebd9;
  --error: #a5293d;
  --shadow: 0 16px 40px -32px rgb(35 65 110 / 55%), 0 1px 2px rgb(35 65 110 / 6%);
  --radius-panel: 16px;
  --radius-control: 9px;
  --gutter: clamp(16px, 4vw, 40px);
  --pad: clamp(16px, 4.4vw, 32px);
  --measure: 69rem;
  --sans: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC", sans-serif;
  --technical: "Bahnschrift", "Aptos", var(--sans);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-height: 100dvh; margin: 0; color: var(--ink); background: var(--page); }
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgb(30 52 84 / 13%) .55px, transparent .75px);
  background-size: 4px 4px;
  opacity: .27;
  content: "";
  pointer-events: none;
}
h1, h2, p { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button, label, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.topbar { color: var(--slate-ink); background: var(--slate); }
.topbar-inner, .shell { width: min(calc(100% - 2 * var(--gutter)), var(--measure)); margin-inline: auto; }
.topbar-inner { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 15px; font-weight: 650; white-space: nowrap; }
.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  color: var(--blue-ink);
  background: var(--blue);
}
.brand-mark .icon { width: 22px; height: 22px; stroke-width: 1.75; }
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding-inline: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  color: var(--quiet);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}
.text-button:hover { color: var(--ink); background: var(--surface-muted); }
.text-button:disabled { cursor: wait; }
.logout { color: var(--slate-quiet); }
.logout .icon { width: 17px; height: 17px; }
.logout:hover { color: var(--slate-ink); background: rgb(239 246 255 / 9%); }
.logout:focus-visible { outline-color: var(--slate-quiet); }
.shell { padding-block: clamp(22px, 5vw, 48px) 40px; }

.entry {
  width: min(100%, 25rem);
  margin: clamp(16px, 10dvh, 88px) auto 0;
  padding: clamp(22px, 6vw, 36px);
  border: 1px solid var(--outline);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.entry-mark, .device-icon {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 12px;
  color: var(--blue);
  background: var(--blue-well);
}
.entry-mark { margin-bottom: 18px; }
.entry-mark .icon { width: 23px; height: 23px; }
.entry h1 { font-size: 25px; font-weight: 750; line-height: 1.2; letter-spacing: -.045em; }
.entry-status { margin-top: 12px; color: var(--quiet); font-size: 14px; }
.retry { margin: 8px -10px -8px; color: var(--blue); }
#login-form { display: grid; gap: 8px; margin-top: 25px; }
#login-form label, .field label { color: var(--ink); font-size: 14px; font-weight: 650; }
#login-form .primary { margin-top: 8px; }

.device {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
}
.device-icon { width: 43px; height: 43px; border: 1px solid var(--outline); color: var(--ink); background: var(--surface); }
.device-icon .icon { width: 21px; height: 21px; }
.device-main { flex: 1 1 auto; min-width: 0; }
.device h1 {
  width: fit-content;
  font: 650 clamp(16px, 4.8vw, 27px)/1.1 var(--technical);
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}
.device p { margin-top: 5px; color: var(--quiet); font-size: 13px; }
.device-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 29px;
  padding-inline: 9px;
  border: 1px solid var(--outline);
  border-radius: 6px;
  color: var(--quiet);
  background: var(--surface-raised);
  font-size: 13px;
  font-weight: 650;
}
.device-status[data-tone="live"] { color: var(--good); }
.device-status[data-tone="warn"] { color: var(--warn); }
.status-dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: currentColor; }

.desk { display: grid; align-items: start; gap: 16px; }
.operations {
  min-width: 0;
  border: 1px solid var(--outline);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.operation-bar { padding: 12px var(--pad); border-bottom: 1px solid var(--outline); }
.tabs {
  display: grid;
  width: min(100%, 244px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--outline);
  border-radius: 11px;
  background: var(--surface-muted);
}
.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding-inline: 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--quiet);
  background: transparent;
  font-size: 15px;
  font-weight: 600;
}
.tab .icon { width: 18px; height: 18px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { border-color: var(--outline); color: var(--blue); background: var(--surface); box-shadow: 0 1px 3px rgb(34 56 93 / 10%); }
.tab-panel { padding: var(--pad); }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 12px; padding: 0; font-size: 15px; font-weight: 750; }

.sources { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.source { position: relative; min-width: 0; cursor: pointer; }
.source input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.source-label {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  min-height: 84px;
  padding: 9px 3px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-control);
  color: var(--quiet);
  background: var(--surface-raised);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}
.source-label .icon { width: 27px; height: 27px; stroke-width: 1.35; }
.source:hover .source-label { color: var(--ink); border-color: var(--outline-strong); }
.source input:checked + .source-label { color: var(--blue); border-color: var(--blue); background: var(--blue-well); font-weight: 750; }
.source input:checked + .source-label::after {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 5px;
  border-bottom: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  content: "";
  transform: rotate(-45deg);
}
.source input:focus-visible + .source-label { outline: 2px solid var(--blue); outline-offset: 2px; }
.source input:disabled + .source-label { cursor: wait; }
.source-hint { width: fit-content; margin-top: 12px; padding: 5px 9px; border-radius: 6px; color: var(--warn); background: var(--warn-well); font-size: 13px; }

.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--outline);
}
.action-spec { display: inline-flex; align-items: center; gap: 5px; color: var(--quiet); font: 550 13px/1.3 var(--technical); white-space: nowrap; }
.action-spec .icon { width: 16px; height: 16px; }
.primary {
  min-height: 46px;
  min-width: 128px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  color: var(--blue-ink);
  background: var(--blue);
  font-size: 15px;
  font-weight: 750;
  transition: background-color 120ms ease;
}
.primary:hover { background: var(--blue-hover); }
.primary:disabled { border-color: var(--outline); color: var(--quiet); background: var(--surface-muted); cursor: default; }
.feedback { margin-top: 10px; color: var(--quiet); font-size: 14px; overflow-wrap: anywhere; }
.feedback[data-kind="error"] { color: var(--error); }

.file-select {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 80px;
  padding: 12px;
  border: 1px dashed var(--outline-strong);
  border-radius: var(--radius-control);
  background: var(--surface-raised);
}
.file-select:hover { border-color: var(--blue); }
.file-select:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.file-select input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.file-select input:disabled { cursor: wait; }
.file-mark { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 8px; color: var(--blue); background: var(--blue-well); }
.file-label { display: grid; flex: 1 1 auto; min-width: 0; gap: 2px; }
.file-label strong { font-size: 14px; overflow-wrap: anywhere; }
.file-detail { color: var(--quiet); font-size: 13px; }
.file-add { display: flex; color: var(--blue); }
.field-grid { display: grid; grid-template-columns: minmax(0, .42fr) minmax(0, 1fr); gap: 12px; margin-top: 16px; }
.field { display: grid; min-width: 0; gap: 5px; }
input[type="number"], input[type="password"], select {
  min-width: 0;
  width: 100%;
  min-height: 46px;
  padding: 7px 10px;
  border: 1px solid var(--outline-strong);
  border-radius: var(--radius-control);
  color: var(--ink);
  background: var(--surface);
}
select { padding-right: 7px; }

.progress { padding: 16px var(--pad) 18px; border-top: 1px solid var(--outline); border-radius: 0 0 var(--radius-panel) var(--radius-panel); background: var(--surface-raised); }
.progress-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.progress-heading h2 { font-size: 15px; font-weight: 750; }
#progress-state { color: var(--quiet); text-align: end; font-size: 13px; font-weight: 650; }
#progress-state[data-tone="live"] { color: var(--blue); }
#progress-state[data-tone="good"] { color: var(--good); }
#progress-state[data-tone="warn"] { color: var(--warn); }
#progress-state[data-tone="error"] { color: var(--error); }
.progress-steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; margin: 14px 0 0; padding: 0; list-style: none; }
.progress-step { position: relative; display: grid; min-width: 0; justify-items: start; align-content: start; gap: 7px; color: var(--quiet); }
.progress-step:not(:last-child)::after { position: absolute; top: 5px; right: 2px; left: 15px; height: 1px; content: ""; background: var(--outline-strong); }
.progress-marker { position: relative; display: block; width: 11px; height: 11px; border: 1px solid var(--outline-strong); border-radius: 50%; background: var(--surface); }
.progress-step-label { font-size: 12px; font-weight: 600; }
.progress-step[data-state="complete"] .progress-marker { border-color: var(--blue); background: var(--blue); }
.progress-step[data-state="complete"] .progress-marker::after { position: absolute; top: 2px; left: 2px; width: 5px; height: 3px; border-bottom: 1.3px solid var(--blue-ink); border-left: 1.3px solid var(--blue-ink); content: ""; transform: rotate(-45deg); }
.progress-step[data-state="complete"]::after { background: var(--blue); }
.progress-step[data-state="current"] { color: var(--blue); }
.progress-step[data-state="current"] .progress-marker { border: 3px solid var(--blue); box-shadow: 0 0 0 2px var(--blue-well); }
.progress-step[data-state="problem"] { color: var(--error); }
.progress-step[data-state="problem"] .progress-marker { border: 3px solid var(--error); }
.progress-detail { margin-top: 10px; color: var(--error); font-size: 13px; overflow-wrap: anywhere; }
.scan-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  padding: clamp(14px, 3vw, 22px);
  border: 1px solid rgb(33 98 72 / 24%);
  border-radius: var(--radius-control);
  background: #edf7f1;
}
.scan-result-status { display: flex; align-items: center; gap: 12px; }
.scan-result-mark {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: var(--good);
  background: #dcefe3;
}
.scan-result-mark .icon { width: 24px; height: 24px; stroke-width: 2.2; }
.scan-result h2 { color: var(--good); font-size: clamp(1.25rem, 2.3vw, 1.5rem); font-weight: 800; }
.progress-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  white-space: nowrap;
}
.progress-download .icon { width: 18px; height: 18px; }

.history { min-width: 0; padding: 0 16px 7px; border: 1px solid var(--outline); border-radius: var(--radius-panel); background: var(--surface-raised); }
.history-heading { display: flex; align-items: center; gap: 7px; min-height: 52px; border-bottom: 1px solid var(--outline); }
.history-heading .icon { width: 18px; height: 18px; color: var(--quiet); }
.history h2 { font-size: 15px; font-weight: 750; }
.history-empty { padding-block: 17px; color: var(--quiet); font-size: 14px; }
.jobs { margin: 0; padding: 0; list-style: none; }
.job { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 4px 8px; min-height: 52px; padding-block: 9px; }
.job + .job { border-top: 1px solid var(--outline); }
.job-main { display: flex; min-width: 0; align-items: baseline; flex-wrap: wrap; gap: 2px 7px; }
.job-main strong { font-size: 14px; font-weight: 750; }
.job-main time { color: var(--quiet); font: 500 12px/1.3 var(--technical); font-variant-numeric: tabular-nums; white-space: nowrap; }
.job-status { display: inline-flex; justify-self: end; align-items: center; gap: 5px; padding-top: 2px; color: var(--quiet); font-size: 12px; font-weight: 650; white-space: nowrap; }
.job-status::before { display: block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.job-status[data-tone="good"] { color: var(--good); }
.job-status[data-tone="warn"] { color: var(--warn); }
.job-status[data-tone="error"] { color: var(--error); }
.job-detail { grid-column: 1 / -1; color: var(--quiet); font-size: 13px; overflow-wrap: anywhere; }
.download {
  display: inline-flex;
  grid-column: 1 / -1;
  justify-self: start;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding-inline: 2px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 730;
  text-decoration: none;
}
.download:hover { text-decoration: underline; text-underline-offset: 3px; }
.download::before {
  display: block;
  width: 14px;
  height: 15px;
  border-bottom: 1.4px solid currentColor;
  background:
    linear-gradient(currentColor, currentColor) center 1px / 1.4px 8px no-repeat,
    linear-gradient(45deg, transparent 44%, currentColor 46% 59%, transparent 61%) 3px 5px / 4px 5px no-repeat,
    linear-gradient(-45deg, transparent 44%, currentColor 46% 59%, transparent 61%) 7px 5px / 4px 5px no-repeat;
  content: "";
}

@media (min-width: 32rem) {
  .device { gap: 13px; }
  .source-label { min-height: 100px; gap: 8px; font-size: 14px; }
  .source-label .icon { width: 30px; height: 30px; }
  .source input:checked + .source-label::after { top: 11px; right: 11px; }
}

@media (min-width: 50rem) {
  .topbar-inner { min-height: 64px; }
  .device { margin-bottom: 23px; }
  .device-icon { width: 49px; height: 49px; }
  .desk { grid-template-columns: minmax(0, 1fr) minmax(17rem, .49fr); gap: 20px; }
  .history { padding-inline: 20px; }
  .progress-steps { gap: 10px; }
  .progress-step-label { font-size: 13px; }
}

@media (max-width: 30rem) {
  .tabs { width: 100%; }
  .progress-download { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .primary { transition: none; }
}
