:root { color-scheme: light; --ink: #202823; --muted: #5e685f; --line: #d6dad0; --canvas: #f3f4ed; --paper: #fff; --green: #276044; --amber: #ffc676; --rust: #ae422c; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 15px/1.5 Inter,"Microsoft YaHei",system-ui,sans-serif; }
h1,h2,h3,p { margin: 0; }
h1 { font-size: clamp(25px,3vw,37px); letter-spacing: -.055em; line-height: 1.15; }
h2 { font-size: 18px; letter-spacing: -.03em; }
h3 { font-size: 14px; }
button,input,select { font: inherit; color: inherit; }
button,select,input { border: 1px solid #c2c9bd; border-radius: 5px; background: var(--paper); }
button,select { cursor: pointer; }
button { padding: .4rem .8rem; font-weight: 550; }
button:hover:not(:disabled), select:hover { border-color: var(--green); }
button:disabled { opacity: .48; cursor: default; }
button:focus-visible,input:focus-visible,select:focus-visible { outline: 3px solid #599fdb; outline-offset: 2px; }
input,select { min-height: 36px; padding: .35rem .55rem; min-width: 0; }
input[type=range],input[type=checkbox] { accent-color: var(--green); }
.masthead { min-height: 64px; display: flex; align-items: center; gap: 18px; padding: 0 clamp(16px,3.1vw,48px); color: #f6f7f2; background: var(--ink); }
.brand { display: flex; gap: 10px; align-items: center; font-size: 23px; font-weight: 700; letter-spacing: -.065em; }
.brand-mark { display: inline-block; width: 23px; height: 23px; border: 4px solid #a9d3a8; border-radius: 5px 0; position: relative; transform: skew(-6deg); }
.brand-mark::after { content: ""; position: absolute; inset: 4px; background: #f0bf75; border-radius: 1px; }
.brand-mark.large { width: 35px; height: 35px; border-width: 6px; }
.product { border-left: 1px solid #556059; padding-left: 18px; color: #cbd5cb; font-size: 14px; }
.mast-actions { display: flex; align-items: center; gap: 17px; margin-left: auto; }
.quiet { background: none; color: inherit; border-color: #647167; }
.connection { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.connection::before,.online::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 3px; border-radius: 50%; background: #a4ada2; }
.connection[data-connected=true]::before,.online[data-online=true]::before { background: #71bd81; }
#signin { min-height: calc(100dvh - 64px); display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px,100%); display: grid; gap: 14px; padding: 36px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 30px #2533220b; }
.login-card h1 { margin: 0 0 12px; }
.primary,.solid { color: #fff; background: var(--green); border-color: var(--green); }
.primary { padding: 10px; }
#workspace { display: grid; grid-template-columns: minmax(170px,219px) minmax(0,1fr); min-height: calc(100dvh - 64px); max-width: 2100px; margin: auto; }
.sidebar { padding: 30px 16px; border-right: 1px solid var(--line); background: #e8ebe1; }
.sidebar-heading { display: flex; align-items: center; gap: 8px; margin: 2px 5px 24px; }
.count { display: inline-grid; place-items: center; min-width: 23px; border-radius: 20px; background: #d1d9cb; color: #394639; font: 600 12px/21px monospace; }
.group { margin: 22px 6px 7px; color: var(--muted); font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
.channel-option { display: flex; align-items: center; gap: 8px; padding: 8px; margin: 3px 0; border-radius: 5px; overflow-wrap: anywhere; cursor: pointer; }
.channel-option:has(:checked) { background: #d8e4d4; }
.channel-option input { min-height: 0; flex-shrink: 0; }
.channel-option .online { margin-left: auto; }
.monitor { min-width: 0; padding: clamp(18px,2.4vw,36px); }
.section-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.layout-select { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.photo-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; margin-top: 22px; }
.photo-grid[data-layout="1"] { grid-template-columns: minmax(0,1fr); }
.photo-grid[data-layout="9"],.photo-grid[data-layout="focus"] { grid-template-columns: repeat(3,minmax(0,1fr)); }
.photo-grid[data-layout="focus"] .tile:first-child { grid-column: 1 / -1; }
.tile { min-width: 0; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; overflow: hidden; }
.tile-header,.tile-footer { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 9px 12px; }
.tile-heading { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-heading h3 { display: inline; font-size: 15px; }
.node-name { color: var(--muted); font-size: 12px; margin-right: 8px; }
.mode-button { min-height: 28px; padding: 2px 8px; flex-shrink: 0; font-size: 12px; }
.stage,.detail-picture { position: relative; background: #242b28; color: #c1cbc4; }
.stage { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 52vh; border: 0; border-radius: 0; padding: 0; }
.stage img,.stage canvas,.detail-picture img,.detail-picture canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
canvas { pointer-events: none; }
.video-stage { position: relative; background: #202624; margin-top: 12px; }
.video-stage video { display: block; width: 100%; height: clamp(180px,46vh,620px); object-fit: contain; }
.video-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.placeholder { display: grid; position: absolute; inset: 0; place-content: center; font-size: 13px; font-weight: 400; }
.tile-footer { flex-wrap: wrap; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.photo-box-toggle,.detail-meta .photo-box-toggle { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }
.photo-box-toggle input { min-height: 0; margin: 0; }
.tile-footer .photo-box-toggle { margin-left: auto; }
.finding[data-defect=true] { color: var(--rust); font-weight: 650; }
.history { margin-top: 22px; padding: clamp(14px,2vw,24px); border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
.live-button { font-size: 13px; color: var(--green); background: #eaf3e7; }
.history-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 9px 13px; margin: 19px 0; }
.history-controls label,.detail-meta label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.history-controls input,.history-controls select { font-size: 14px; color: var(--ink); }
#layer { width: 90px; }
.timeline-head,.timeline-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.history { --lane-label: min(23%,165px); --lane-gap: 8px; }
.timeline-head { margin-left: calc(var(--lane-label) + var(--lane-gap)); }
.timeline-tools,.choice-paging { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; }
.timeline-tools { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.timeline-tools button,.choice-paging button { color: var(--ink); padding: 3px 10px; }
.lanes { margin: 6px 0; user-select: none; }
.lane { display: flex; align-items: center; gap: var(--lane-gap); min-height: 28px; border-top: 1px solid #e7eae2; }
.lane-name { width: var(--lane-label); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.lane-track { position: relative; height: 32px; flex: 1; min-width: 0; cursor: crosshair; touch-action: pan-y; background: repeating-linear-gradient(90deg,transparent 0,transparent calc(10% - 1px),#e8ebe3 10%); }
.point { position: absolute; height: 100%; top: 0; padding: 0; border: none; border-radius: 3px; background: transparent; color: #406748; }
.point::before { content: ""; position: absolute; left: clamp(3px,var(--photo-x,50%),calc(100% - 3px)); top: 9px; width: 5px; height: 14px; transform: translateX(-50%); border-radius: 2px; background: currentColor; }
.point.defect { color: var(--rust); }
.point.cluster::before { display: none; }
.point.cluster span { display: inline-block; max-width: 100%; border-radius: 4px; padding: 1px 3px; color: white; background: #497352; font: 650 11px/18px system-ui,sans-serif; }
.point.cluster.defect span,.key.defect { background: var(--rust); }
.point:hover { background: #678d6c22; }
.cursor { position: absolute; inset-block: 0; width: 2px; background: #2c3530; pointer-events: none; }
.lanes.brushing .lane-track::after { content: ""; position: absolute; left: var(--brush-start); width: var(--brush-width); inset-block: 0; border-inline: 1px solid var(--green); background: #49735232; pointer-events: none; }
#photo-choices { width: min(570px,94vw); }
#choices-summary,.choice-paging { padding: 6px 18px 12px; color: var(--muted); font-size: 13px; }
#choices-list { max-height: 51vh; min-height: 48px; overflow: auto; padding: 0 18px 8px; }
.photo-choice { display: grid; width: 100%; text-align: left; margin-bottom: 5px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.photo-choice small { color: var(--muted); }
#scrubber { display: block; width: calc(100% - var(--lane-label) - var(--lane-gap)); min-height: 20px; padding: 0; margin: 0 0 6px calc(var(--lane-label) + var(--lane-gap)); }
.key { display: inline-block; width: 7px; height: 7px; background: #60876b; border-radius: 2px; margin: 0 3px 0 9px; }
.blank { padding: clamp(24px,6vw,70px) 14px; color: var(--muted); text-align: center; border: 1px dashed #c2cbbd; border-radius: 8px; }
.error { color: #8d3023; background: #fff1e8; padding: 8px 12px; margin: 8px 0; border-radius: 4px; }
dialog { padding: 0; width: min(1100px,94vw); max-height: 94dvh; border: 0; border-radius: 10px; }
dialog::backdrop { background: #121b17b8; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; }
.inspection-layout { display: grid; grid-template-columns: minmax(0,1fr) 230px; }
.detail-scroll { overflow: auto; background: #242b28; }
.detail-picture { height: clamp(260px,62vh,680px); }
.detail-meta { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 16px; max-height: 64vh; overflow: auto; }
.detail-meta h3 { margin-top: 12px; }
dl { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
dt { color: var(--muted); }
dd { margin: 0 0 6px; }
.detection-row { display: block; margin-bottom: 5px; text-align: left; width: 100%; font-size: 13px; }
.detection-row[aria-pressed=true] { border-color: var(--rust); background: #fff0dc; }
@media (max-width: 850px) {
  #workspace { grid-template-columns: 150px minmax(0,1fr); }
  .sidebar { padding-inline: 8px; }
  .photo-grid[data-layout="9"] { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 650px) {
  .masthead { min-height: 54px; gap: 10px; }
  .product { display: none; }
  .brand { font-size: 20px; }
  #workspace { display: block; }
  .sidebar { padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-heading { margin: 0 0 4px; }
  .sidebar-heading h2 { font-size: 15px; }
  #channels { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
  .group { margin: 0 5px 0 0; }
  .channel-option { margin: 0; padding: 3px 6px; }
  .photo-grid,.photo-grid[data-layout="9"],.photo-grid[data-layout="focus"] { grid-template-columns: minmax(0,1fr); }
  .inspection-layout { display: block; }
  .detail-picture { height: 40vh; }
  .detail-meta { max-height: none; }
}
