:root {
  --ink: #121826;
  --muted: #7d8494;
  --muted-2: #a2a8b4;
  --line: #e8ebf0;
  --paper: #ffffff;
  --canvas: #f5f7fa;
  --navy: #0b1020;
  --blue: #4b66f5;
  --blue-soft: #eef1ff;
  --teal: #35c5ad;
  --orange: #ffad62;
  font-family: "Manrope", "Noto Sans TC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 1100px; background: var(--canvas); }
button, select, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 250px; background: var(--navy); color: #fff; padding: 34px 18px 24px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 13px 43px; }
.brand-mark { width: 31px; height: 31px; border: 1px solid rgba(255,255,255,.55); border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff; transform: rotate(-4deg); }
.brand-name { letter-spacing: -.04em; font-size: 18px; font-weight: 800; line-height: 1; }
.brand-caption { color: #717b91; font: 500 8px "DM Mono", monospace; letter-spacing: .13em; margin-top: 5px; }
.sidebar-section { padding: 0 6px; margin-bottom: 31px; }
.eyebrow { font: 500 10px "DM Mono", monospace; letter-spacing: .15em; text-transform: uppercase; color: #9ea5b6; }
.nav-item { color: #b2b9ca; background: transparent; border: 0; width: 100%; text-align: left; display: flex; align-items: center; gap: 13px; padding: 12px 13px; margin-top: 8px; border-radius: 8px; font-size: 13px; }
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(255,255,255,.09); }
.nav-item.active { box-shadow: inset 2px 0 var(--teal); }
.nav-icon { color: #79849b; width: 17px; font-size: 17px; text-align: center; }
.nav-item.active .nav-icon { color: var(--teal); }
.section-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 8px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px rgba(255,173,98,.11); }
.live-dot.connected { background: var(--teal); box-shadow: 0 0 0 4px rgba(53,197,173,.11); }
.device-card { margin: 13px 0 9px; padding: 13px 10px; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); border-radius: 9px; }
.device-card-icon { width: 31px; height: 31px; border-radius: 7px; display: grid; place-items: center; color: var(--teal); background: rgba(53,197,173,.12); }
.device-card-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 4px; }
.device-card-copy strong { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-card-copy span { color: #7e889e; font: 10px "DM Mono", monospace; }
.device-chevron { color: #7a859b; font-size: 23px; line-height: 1; }
.text-button { background: transparent; color: #8993a8; border: 0; font-size: 11px; padding: 4px 8px; }
.text-button:hover { color: #fff; }
.sidebar-footer { margin-top: auto; padding: 0 8px; }
.security-note { display: flex; gap: 9px; color: #7a869c; font-size: 10px; line-height: 1.55; padding: 14px 0 21px; border-top: 1px solid rgba(255,255,255,.08); }
.security-note span:first-child { color: var(--teal); font-size: 15px; }
.version { font: 500 9px "DM Mono", monospace; color: #687288; letter-spacing: .08em; }
.version span { color: #454f64; }

.main-panel { flex: 1; min-width: 0; padding: 39px 47px 19px; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 27px; }
.breadcrumb { font: 500 10px "DM Mono", monospace; color: #a0a6b3; letter-spacing: .03em; margin-bottom: 8px; }
.breadcrumb span { color: #d6d9e0; padding: 0 9px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; letter-spacing: -.055em; line-height: 1.1; }
h2 { font-size: 17px; letter-spacing: -.04em; margin-top: 7px; }
.topbar-actions { display: flex; align-items: center; gap: 15px; padding-top: 10px; }
.connection-pill { display: flex; align-items: center; gap: 8px; border: 1px solid #dfe4ed; border-radius: 999px; padding: 8px 12px; color: #737c8e; background: rgba(255,255,255,.7); font: 500 10px "DM Mono", monospace; }
.pill-dot, .status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.connection-pill.connected .pill-dot { background: var(--teal); }
.icon-button, .avatar { border: 0; width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; }
.icon-button { background: #fff; border: 1px solid var(--line); color: #848b98; font-weight: 700; }
.avatar { color: #fff; background: var(--navy); font-size: 11px; font-weight: 800; }
.workspace-grid { display: grid; grid-template-columns: minmax(520px, 1fr) 342px; grid-template-rows: minmax(390px, auto) minmax(220px, 1fr); gap: 17px; flex: 1; min-height: 0; }
.panel { background: var(--paper); border: 1px solid #e9ecf1; border-radius: 11px; box-shadow: 0 5px 22px rgba(24,36,66,.025); }
.control-panel { grid-column: 2; grid-row: 1; padding: 20px 18px 16px; display: flex; flex-direction: column; border-radius: 9px; border-top: 4px solid var(--orange); }
.panel-heading { display: flex; justify-content: space-between; margin-bottom: 25px; }
.panel-heading h2 { margin-top: 8px; }
.step-count { color: #c0c5ce; font: 10px "DM Mono", monospace; padding-top: 3px; }
.field-label { display: block; color: #757d8d; font-size: 10px; font-weight: 700; margin-bottom: 7px; }
.select-wrap { position: relative; margin-bottom: 17px; }
.select-wrap select { appearance: none; width: 100%; border: 1px solid #e3e7ee; background: #fbfcfd; color: #323a4a; border-radius: 7px; padding: 11px 33px 11px 11px; font-size: 11px; outline: none; }
.select-wrap select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(75,102,245,.1); }
.select-wrap > span { position: absolute; right: 12px; top: 9px; color: #939aa7; pointer-events: none; font-size: 15px; }
.bridge-hint { display: flex; gap: 7px; align-items: flex-start; background: var(--blue-soft); color: #7a86bd; font-size: 9px; line-height: 1.5; padding: 8px 9px; border-radius: 6px; margin: -5px 0 21px; }
.bridge-hint span:first-child { border: 1px solid #9ca8e1; border-radius: 50%; width: 13px; height: 13px; display: grid; place-items: center; font: 9px Georgia, serif; flex: 0 0 auto; }
.bridge-hint.connected { background: #ebfaf7; color: #468d80; }
.bridge-hint.connected span:first-child { border-color: #7ccaba; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.select-wrap.compact select { padding-left: 9px; padding-right: 26px; }
.select-wrap.compact > span { right: 9px; }
.divider { height: 1px; background: #edf0f4; margin: 3px 0 9px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 11px; padding: 9px 0; }
.toggle-row strong, .toggle-row span { display: block; }
.toggle-row strong { font-size: 10px; margin-bottom: 4px; }
.toggle-row div span { color: #a0a6b1; font-size: 9px; }
.toggle { width: 29px; height: 17px; padding: 2px; border-radius: 999px; border: 0; background: #dfe3ea; transition: .2s; }
.toggle span { display: block; width: 13px; height: 13px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle.on { background: var(--blue); }
.toggle.on span { transform: translateX(12px); }
.action-stack { margin-top: auto; padding-top: 21px; }
.primary-button, .secondary-button { width: 100%; border-radius: 7px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 11px; font-weight: 800; }
.primary-button { color: #fff; background: #ff8c17; border: 0; padding: 13px 10px; box-shadow: 0 6px 13px rgba(255,140,23,.22); }
.primary-button:hover { background: #ed7907; transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: .8; transform: none; }
.scan-glyph { font-size: 19px; line-height: 12px; font-weight: 400; }
.shortcut { margin-left: auto; color: #b9c4ff; font: 9px "DM Mono", monospace; }
.secondary-button { color: #6e7788; background: #fff; border: 1px solid #e0e4ea; padding: 11px 10px; margin-top: 9px; cursor: pointer; }
.secondary-button:hover { border-color: #bfc7d9; color: var(--ink); }
.keyboard-note { color: #afb5c0; font-size: 9px; text-align: center; margin-top: 12px; }
kbd { padding: 2px 4px; border: 1px solid #e1e4e9; border-radius: 3px; background: #fafbfc; font: 9px "DM Mono", monospace; }

.viewer-panel { grid-column: 1; grid-row: 1 / span 2; display: flex; flex-direction: column; min-height: 650px; overflow: hidden; border-radius: 5px; }
.viewer-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 13px 16px; border-bottom: 1px solid #24262b; background: #303236; }
.viewer-title { display: flex; align-items: center; gap: 8px; color: #f5f6f8; font-size: 11px; font-weight: 700; }
.status-dot { background: #bec5d0; }
.status-dot.scanning { background: var(--orange); animation: pulse 1s infinite; }
.status-dot.ready { background: var(--teal); }
.toolbar-actions { display: flex; gap: 3px; }
.tool-button { border: 0; background: transparent; color: #c3c6cc; padding: 5px 7px; font-size: 11px; }
.tool-button:hover { color: #fff; }
.tool-button span { font-size: 9px; margin-left: 3px; }
.viewer-stage { flex: 1; display: grid; place-items: center; position: relative; overflow: hidden; background: radial-gradient(circle at 50% 43%, #fff 0%, #fafbfc 53%, #f7f8fa 100%); }
.empty-state { text-align: center; color: #abb2be; }
.empty-icon { width: 55px; height: 68px; margin: 0 auto 17px; border: 1.5px solid #dce1e9; color: #c4cad4; font-size: 24px; display: grid; place-items: center; border-radius: 5px; transform: rotate(-2deg); box-shadow: 5px 6px 0 -4px #f0f2f5; }
.empty-state h3 { font-size: 13px; color: #7d8594; margin-bottom: 9px; }
.empty-state p { font-size: 10px; line-height: 1.7; }
.empty-line { display: flex; align-items: center; gap: 9px; justify-content: center; margin-top: 25px; color: #c9ced7; }
.empty-line span { height: 1px; width: 32px; background: #e5e8ed; }
.empty-line small { font: 9px "DM Mono", monospace; letter-spacing: .12em; }
#preview-image { max-width: calc(100% - 100px); max-height: calc(100% - 64px); box-shadow: 0 12px 28px rgba(29,41,72,.18); border-radius: 2px; transition: transform .2s; }
.scan-overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 10px; color: #667087; background: rgba(255,255,255,.84); backdrop-filter: blur(4px); font-size: 12px; }
.scan-overlay.is-visible { display: flex; }
.scan-overlay span { color: #a5abb8; font: 9px "DM Mono", monospace; }
.spinner { width: 25px; height: 25px; border: 2px solid #dce2ff; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
.viewer-footer { display: flex; align-items: center; gap: 12px; color: #a1a7b2; border-top: 1px solid #eef0f4; padding: 10px 17px; font: 9px "DM Mono", monospace; }
.zoom-readout { margin-left: auto; }
.viewer-nav { display: flex; align-items: center; gap: 11px; color: #7b8492; }
.viewer-nav button { width: 20px; height: 20px; padding: 0; border: 1px solid #e3e7ec; border-radius: 5px; background: #fff; color: #8f97a3; font-size: 17px; line-height: 1; }
.viewer-nav button:not(:disabled):hover { color: var(--blue); border-color: #b8c2f5; }
.viewer-nav button:disabled { opacity: .35; cursor: not-allowed; }

.queue-panel { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; padding: 17px 14px 14px; min-height: 0; border-radius: 9px; }
.queue-heading { display: flex; justify-content: space-between; padding: 0 5px 17px; }
.queue-heading h2 { margin-top: 7px; font-size: 16px; }
.more-button { color: #9ba2ad; background: transparent; border: 0; letter-spacing: 2px; }
.thumbnail-list { flex: 1; overflow: auto; padding: 1px 4px; }
.queue-empty { min-height: 105px; border: 1px dashed #e0e4eb; border-radius: 8px; display: grid; place-items: center; align-content: center; gap: 8px; color: #b4bbc6; text-align: center; }
.queue-empty span { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid #dce1e8; border-radius: 50%; font-size: 17px; }
.queue-empty p { font-size: 9px; line-height: 1.5; }
.thumb-card { position: relative; padding: 5px; margin-bottom: 10px; border: 1px solid #e9ecf1; border-radius: 7px; cursor: pointer; background: #fff; }
.thumb-card.active { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(75,102,245,.1); }
.thumb-card img { display: block; width: 100%; height: 110px; object-fit: contain; background: #f3f5f7; border-radius: 4px; }
.thumb-meta { display: flex; justify-content: space-between; color: #999fac; padding: 7px 2px 1px; font: 8px "DM Mono", monospace; }
.thumb-remove { position: absolute; top: 8px; right: 8px; width: 19px; height: 19px; display: none; border: 0; border-radius: 50%; color: #fff; background: rgba(18,24,38,.72); font-size: 12px; line-height: 1; }
.thumb-card:hover .thumb-remove { display: grid; place-items: center; }
.queue-bottom { border-top: 1px solid #edf0f3; padding-top: 13px; margin-top: 13px; }
.export-button { width: 100%; border: 0; border-radius: 4px; padding: 11px; background: #e7eaff; color: #5369d8; font-size: 10px; font-weight: 800; }
.export-button:disabled { color: #aeb5c4; background: #f2f4f7; cursor: not-allowed; }
.export-format { display: flex; justify-content: space-between; align-items: center; padding: 12px 1px 0; color: #a1a7b2; font: 9px "DM Mono", monospace; }
.export-format select { border: 0; background: transparent; color: #697385; font: 9px "DM Mono", monospace; outline: none; }
.app-footer { display: flex; align-items: center; color: #a7adb8; font: 9px "DM Mono", monospace; padding-top: 15px; }
.footer-separator { padding: 0 8px; color: #d1d5dd; }
.footer-spacer { flex: 1; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; padding: 11px 17px; border-radius: 999px; color: #fff; background: #161e31; box-shadow: 0 10px 28px rgba(11,16,32,.22); font-size: 11px; transition: .25s; z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@media (max-width: 1250px) { .main-panel { padding-left: 28px; padding-right: 28px; } .workspace-grid { grid-template-columns: minmax(440px, 1fr) 290px; } .tool-button span { display: none; } }
@media (max-width: 980px) { body { min-width: 0; } .app-shell { display: block; } .sidebar { width: 100%; min-height: auto; padding: 18px 20px; } .brand { padding: 0 0 18px; } .sidebar-section { margin-bottom: 12px; } .device-section, .sidebar-footer { display: none; } .nav-item { display: inline-flex; width: auto; margin: 0 5px 0 0; } .main-panel { padding: 24px 18px; } .workspace-grid { display: flex; flex-direction: column; } .control-panel, .viewer-panel, .queue-panel { min-height: auto; } .viewer-panel { order: 1; min-height: 540px; } .control-panel { order: 2; } .queue-panel { order: 3; } }
