:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #17212b;
  background: #f5f7fa;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f5f7fa; }
a { color: inherit; }
.shell { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 48px 0 72px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.eyebrow { margin: 0 0 8px; color: #1976d2; font-size: 12px; font-weight: 700; letter-spacing: 0; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 40px; line-height: 1.15; letter-spacing: 0; }
h2 { margin-bottom: 8px; font-size: 20px; letter-spacing: 0; }
.connection, .step { color: #66727d; font-size: 13px; white-space: nowrap; }
.connection { display: inline-flex; align-items: center; gap: 8px; padding-top: 8px; }
.topbar-actions { display: flex; align-items: flex-start; gap: 22px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #21a366; }
.dot.offline { background: #d49a18; }
.panel { background: #fff; border: 1px solid #e0e5ea; border-radius: 8px; box-shadow: 0 10px 30px rgb(28 48 64 / 5%); }
.query-panel, .result-panel { padding: 32px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.panel-heading p { margin-bottom: 0; color: #6c7884; font-size: 14px; }
.step { color: #1976d2; font-weight: 700; }
.query-form { max-width: 760px; }
.mode-tabs { display: inline-flex; gap: 4px; margin-bottom: 24px; padding: 4px; border: 1px solid #dfe5ea; border-radius: 6px; background: #f4f7f9; }
.mode-tab { min-width: 104px; height: 36px; padding: 0 14px; border-radius: 4px; color: #65727d; background: transparent; font-size: 14px; font-weight: 650; }
.mode-tab:hover { background: #e9eef2; }
.mode-tab.active { color: #145ea8; background: #fff; box-shadow: 0 1px 4px rgb(26 45 60 / 12%); }
label { display: block; margin-bottom: 10px; color: #44515d; font-size: 14px; font-weight: 650; }
.input-row { display: flex; gap: 12px; }
input { width: 100%; min-width: 0; height: 48px; padding: 0 14px; border: 1px solid #cbd4dd; border-radius: 6px; color: #17212b; background: #fff; font: inherit; font-size: 15px; outline: none; }
input:focus { border-color: #1976d2; box-shadow: 0 0 0 3px rgb(25 118 210 / 12%); }
textarea { display: block; width: 100%; min-height: 210px; resize: vertical; padding: 13px 14px; border: 1px solid #cbd4dd; border-radius: 6px; color: #17212b; background: #fff; font: inherit; font-size: 15px; line-height: 1.6; outline: none; }
textarea:focus { border-color: #1976d2; box-shadow: 0 0 0 3px rgb(25 118 210 / 12%); }
button { display: inline-flex; align-items: center; justify-content: center; gap: 16px; min-width: 112px; height: 48px; padding: 0 18px; border: 0; border-radius: 6px; color: #fff; background: #1976d2; font: inherit; font-weight: 700; cursor: pointer; }
button:hover { background: #125fae; }
.hint { margin: 12px 0 0; color: #89949e; font-size: 12px; }
.batch-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.batch-form-footer .hint { margin-top: 10px; }
.batch-count { color: #788490; font-size: 12px; white-space: nowrap; }
.batch-count.over-limit { color: #b3261e; font-weight: 700; }
.info-band { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 24px; border-top: 1px solid #dfe5ea; border-bottom: 1px solid #dfe5ea; }
.info-band div { display: grid; gap: 6px; padding: 20px 0; }
.info-band div + div { padding-left: 24px; border-left: 1px solid #dfe5ea; }
.info-band strong { font-size: 14px; }
.info-band span { color: #788490; font-size: 13px; }
.back-link { padding-top: 8px; color: #1976d2; font-size: 14px; text-decoration: none; }
.loading-state, .error-state { display: flex; align-items: center; gap: 16px; min-height: 150px; }
.loading-state strong, .error-state strong { display: block; margin-bottom: 7px; font-size: 18px; }
.loading-state span:not(.spinner), .error-state span { display: block; color: #76828d; font-size: 14px; }
.spinner { width: 24px; height: 24px; border: 3px solid #d9e7f5; border-top-color: #1976d2; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-state { color: #b3261e; }
.error-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; background: #d14343; font-weight: 700; }
.result-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
.result-heading h2 { margin-bottom: 8px; }
.order-number { color: #6c7884; font-size: 14px; }
.status { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 4px; color: #13653c; background: #e4f3eb; font-size: 14px; font-weight: 700; white-space: nowrap; }
.status.empty { color: #8a5a00; background: #fff1cf; }
.status.abnormal { color: #a3341f; background: #ffebe6; }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.meta-item { padding: 14px 16px; border: 1px solid #e5e9ed; border-radius: 6px; }
.meta-item span { display: block; margin-bottom: 5px; color: #84909a; font-size: 12px; }
.meta-item strong { font-size: 14px; overflow-wrap: anywhere; }
.exception-reason { grid-column: 1 / -1; border-color: #f0c8bd; background: #fff8f6; }
.exception-reason strong { color: #8c2d1c; }
.screenshot-wrap { border-top: 1px solid #e5e9ed; padding-top: 24px; }
.screenshot-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.screenshot-heading strong { font-size: 15px; }
.download { color: #1976d2; font-size: 13px; text-decoration: none; }
.screenshot { display: block; width: 100%; height: auto; border: 1px solid #dfe5ea; background: #f8fafc; cursor: zoom-in; }
.screenshot:focus-visible { outline: 3px solid rgb(25 118 210 / 35%); outline-offset: 3px; }
body.viewer-open { overflow: hidden; }
.image-viewer[hidden] { display: none; }
.image-viewer { position: fixed; inset: 0; z-index: 1000; display: grid; grid-template-rows: 1fr; background: rgb(9 16 24 / 94%); }
.image-viewer-close { position: fixed; top: 18px; right: 22px; z-index: 2; width: 44px; min-width: 44px; height: 44px; padding: 0; border: 1px solid rgb(255 255 255 / 28%); border-radius: 6px; color: #fff; background: rgb(13 22 31 / 82%); font-size: 30px; font-weight: 400; line-height: 1; }
.image-viewer-close:hover { background: #243543; }
.image-viewer-close:focus-visible { outline: 3px solid rgb(255 255 255 / 50%); outline-offset: 2px; }
.image-viewer-scroll { overflow: auto; padding: 78px 32px 32px; }
.image-viewer-image { display: block; width: auto; max-width: none; height: auto; margin: 0 auto; background: #fff; box-shadow: 0 18px 50px rgb(0 0 0 / 38%); }
.batch-shell { width: min(1280px, calc(100% - 48px)); }
.batch-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.batch-summary h2 { margin-bottom: 5px; }
.batch-summary p { margin-bottom: 0; color: #77838e; font-size: 14px; }
.batch-percent { color: #1976d2; font-size: 24px; font-weight: 750; }
.progress-track { height: 8px; margin: 18px 0 14px; overflow: hidden; border-radius: 4px; background: #e9eef2; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: #1976d2; transition: width 240ms ease; }
.batch-counts { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 22px; color: #66737e; font-size: 13px; }
.batch-list { border-top: 1px solid #dfe5ea; }
.batch-row { display: grid; grid-template-columns: 36px minmax(260px, 1fr) 120px auto; align-items: center; gap: 16px; min-height: 78px; border-bottom: 1px solid #e4e9ed; }
.batch-index { color: #9aa4ad; font-size: 13px; text-align: center; }
.batch-order { display: grid; gap: 7px; min-width: 0; }
.batch-order strong { font-size: 14px; overflow-wrap: anywhere; }
.batch-order span { color: #75818c; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.batch-status { justify-self: start; padding: 5px 9px; border-radius: 4px; color: #596671; background: #edf1f4; font-size: 12px; font-weight: 700; white-space: nowrap; }
.batch-status.running { color: #145ea8; background: #e6f1fb; }
.batch-status.succeeded { color: #13653c; background: #e4f3eb; }
.batch-status.failed, .batch-status.abnormal { color: #a3341f; background: #ffebe6; }
.batch-actions { display: flex; justify-content: flex-end; gap: 8px; }
.small-button { min-width: 0; width: auto; height: 34px; padding: 0 11px; border: 1px solid #cdd6de; color: #31516c; background: #fff; font-size: 12px; font-weight: 650; }
.small-button:hover { border-color: #8e9da9; background: #f3f6f8; }
.small-button:disabled { cursor: wait; opacity: 0.65; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.history-shell { width: min(1280px, calc(100% - 48px)); }
.history-panel { padding: 32px; }
.history-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.history-heading p { margin-bottom: 0; color: #6c7884; font-size: 14px; }
.history-search { display: flex; gap: 10px; width: min(480px, 100%); }
.history-search button { height: 44px; min-width: 88px; }
.history-search input { height: 44px; }
.history-list { min-height: 180px; border-top: 1px solid #dfe5ea; }
.history-row { display: grid; grid-template-columns: minmax(280px, 1fr) 60px 120px 170px 24px; align-items: center; gap: 16px; min-height: 78px; border-bottom: 1px solid #e4e9ed; text-decoration: none; }
.history-row:hover { background: #f8fafc; }
.history-row:focus-visible { outline: 3px solid rgb(25 118 210 / 28%); outline-offset: -3px; }
.history-order { display: grid; gap: 7px; min-width: 0; }
.history-order strong { font-size: 14px; overflow-wrap: anywhere; }
.history-order span { color: #75818c; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.history-source { color: #77838e; font-size: 12px; }
.history-row time { color: #77838e; font-size: 12px; white-space: nowrap; }
.history-arrow { color: #1976d2; font-size: 18px; }
.history-empty { display: grid; place-items: center; align-content: center; gap: 8px; min-height: 220px; text-align: center; }
.history-empty strong { font-size: 17px; }
.history-empty span { color: #77838e; font-size: 14px; }
.history-error { border-bottom: 1px solid #e4e9ed; }
.history-footer { display: flex; justify-content: center; padding-top: 20px; }
.history-more { min-width: 112px; }
.history-more[hidden] { display: none; }
@media (max-width: 700px) {
  .shell { width: min(100% - 28px, 1120px); padding-top: 28px; }
  h1 { font-size: 32px; }
  .topbar, .panel-heading, .result-heading, .history-heading { flex-direction: column; align-items: stretch; }
  .topbar-actions { justify-content: space-between; }
  .query-panel, .result-panel { padding: 22px; }
  .input-row { flex-direction: column; }
  button:not(.mode-tab, .small-button, .image-viewer-close, .history-search-button) { width: 100%; }
  .mode-tabs { display: flex; }
  .mode-tab { width: 50%; min-width: 0; }
  .batch-form-footer { align-items: flex-start; }
  .info-band { grid-template-columns: 1fr; }
  .info-band div + div { padding-left: 0; border-left: 0; border-top: 1px solid #dfe5ea; }
  .meta-grid { grid-template-columns: 1fr; }
  .image-viewer-close { top: 12px; right: 12px; }
  .image-viewer-scroll { padding: 68px 16px 20px; }
  .batch-shell { width: min(100% - 28px, 1280px); }
  .batch-row { grid-template-columns: 28px minmax(0, 1fr); gap: 10px 12px; padding: 14px 0; }
  .batch-status { grid-column: 2; }
  .batch-actions { grid-column: 2; justify-content: flex-start; }
  .history-shell { width: min(100% - 28px, 1280px); }
  .history-panel { padding: 22px; }
  .history-search { width: 100%; }
  .history-search button { width: auto; }
  .history-row { grid-template-columns: minmax(0, 1fr) auto; gap: 9px 12px; padding: 15px 0; }
  .history-order { grid-column: 1 / -1; }
  .history-source { grid-column: 1; }
  .history-row .batch-status { grid-column: 2; grid-row: 2; justify-self: end; }
  .history-row time { grid-column: 1; grid-row: 3; }
  .history-arrow { grid-column: 2; grid-row: 3; justify-self: end; }
}
