:root {
  color-scheme: light;
  --bg: #f4f5f6;
  --surface: #ffffff;
  --ink: #20252b;
  --muted: #69717a;
  --line: #dfe2e5;
  --accent: #b52d25;
  --link: #165d9c;
  --success: #26734d;
  --warning: #9a6300;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; color: var(--ink); background: var(--bg); font: 14px/1.55 Arial, "Microsoft YaHei", sans-serif; }
a { color: inherit; }
button, input, select { font: inherit; }
button, .link-button { border: 0; cursor: pointer; }

.app-header { height: 58px; padding: 0 max(20px, calc((100vw - 1440px) / 2)); display: flex; align-items: center; justify-content: space-between; background: #20252b; color: #fff; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-size: 17px; font-weight: 700; text-decoration: none; }
.brand img { width: 32px; height: 32px; }
.header-actions { display: flex; align-items: center; gap: 26px; }
.app-nav { height: 58px; display: flex; align-items: stretch; }
.app-nav a { min-width: 84px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; color: #cfd3d7; text-decoration: none; border-bottom: 3px solid transparent; }
.app-nav a:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.app-nav a[aria-current="page"] { color: #fff; border-bottom-color: #e25549; }
.header-meta { display: flex; align-items: center; gap: 7px; color: #cfd3d7; font-size: 13px; }
.source-dot { width: 7px; height: 7px; border-radius: 50%; margin-left: 9px; }
.source-dot.hunan { background: #e25549; }
.source-dot.guangxi { background: #4a9d72; }

.toolbar-band { background: var(--surface); border-bottom: 1px solid var(--line); }
.filters { max-width: 1440px; margin: 0 auto; padding: 18px 20px; display: grid; grid-template-columns: minmax(240px, 1.8fr) repeat(6, minmax(130px, 1fr)) auto; gap: 12px; align-items: end; }
.filters label { min-width: 0; }
.filters label > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.filters input, .filters select { width: 100%; height: 36px; padding: 0 10px; border: 1px solid #cdd1d5; border-radius: 4px; background: #fff; color: var(--ink); outline: none; }
.filters input:focus, .filters select:focus { border-color: var(--link); box-shadow: 0 0 0 2px rgba(22, 93, 156, .12); }
.filter-actions { height: 36px; display: flex; align-items: center; gap: 12px; }
.primary { min-height: 36px; padding: 8px 17px; border-radius: 4px; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; }
.primary:hover { background: #93231d; }
.text-action { color: var(--link); text-decoration: none; white-space: nowrap; }
.text-action:hover { text-decoration: underline; }

.summary-band { max-width: 1440px; margin: 0 auto; padding: 18px 20px; display: grid; grid-template-columns: repeat(3, minmax(120px, 180px)) minmax(240px, 1fr); border-bottom: 1px solid var(--line); }
.summary-band > div { min-height: 52px; padding: 4px 22px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.summary-band > div:first-child { padding-left: 0; }
.summary-band > div:last-child { border-right: 0; }
.summary-band strong { font-size: 22px; letter-spacing: 0; }
.summary-band span { color: var(--muted); font-size: 12px; }
.summary-band .sync-state { align-items: flex-end; }
.sync-state strong { color: var(--success); font-size: 14px; text-transform: uppercase; }

.results-section { max-width: 1440px; margin: 0 auto; padding: 8px 20px 40px; }
.results-head { height: 54px; display: flex; align-items: center; justify-content: space-between; }
.results-head h1 { margin: 0; font-size: 17px; }
.results-head span { color: var(--muted); }
.result-grid { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(180px, 250px) 130px 110px; gap: 20px; align-items: center; }
.grid-header { min-height: 38px; padding: 0 16px; border: 1px solid var(--line); border-bottom: 0; background: #eceeef; color: var(--muted); font-size: 12px; font-weight: 700; }
.result-list { border: 1px solid var(--line); background: var(--surface); }
.result-row { min-height: 82px; padding: 13px 16px; border-bottom: 1px solid var(--line); text-decoration: none; }
.result-row:last-child { border-bottom: 0; }
.result-row:hover { background: #fafbfc; box-shadow: inset 3px 0 var(--accent); }
.result-row > span, .result-row time { min-width: 0; }
.notice-main, .notice-source { display: flex; flex-direction: column; gap: 5px; }
.notice-title { overflow-wrap: anywhere; font-size: 15px; font-weight: 700; }
.notice-subtitle, .notice-source > span:last-child { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.source-label, .status-label { display: inline-flex; width: fit-content; min-height: 23px; align-items: center; padding: 2px 7px; border-radius: 3px; font-size: 12px; }
.source-label.hunan { color: #9b2820; background: #fbe9e7; }
.source-label.guangxi { color: #246b47; background: #e7f4ec; }
.status-label { color: #735000; background: #fff3d7; }
.result-row time { color: var(--muted); }
.empty-state { padding: 60px 20px; color: var(--muted); text-align: center; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding: 20px 0; }
.pagination a { color: var(--link); text-decoration: none; }
.pagination span { color: var(--muted); }

.task-control-band { border-bottom: 1px solid var(--line); background: var(--surface); }
.task-shell { width: min(100%, 1440px); margin: 0 auto; padding-right: 20px; padding-left: 20px; }
.task-page-heading, .task-monitor-head, .history-heading, .log-heading { display: flex; align-items: center; justify-content: space-between; }
.task-page-heading { min-height: 62px; }
.task-page-heading h1, .task-monitor-head h2, .history-heading h2, .log-heading h2 { margin: 0; font-size: 17px; letter-spacing: 0; }
.task-page-heading > span, .history-heading > span, .log-heading > span { color: var(--muted); font-size: 12px; }
.task-form { min-height: 78px; padding: 0 0 18px; display: grid; grid-template-columns: minmax(280px, 1fr) 120px 120px 110px auto; gap: 14px; align-items: end; }
.source-selector { min-width: 0; margin: 0; padding: 0; display: flex; gap: 8px; border: 0; }
.source-selector legend, .days-field > span { margin-bottom: 6px; display: block; color: var(--muted); font-size: 12px; }
.source-selector legend { width: 100%; }
.check-option { min-height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid #cdd1d5; border-radius: 4px; background: #fff; cursor: pointer; user-select: none; }
.check-option:has(input:checked) { border-color: #8e969e; background: #f5f7f8; }
.check-option input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.check-option .source-dot { margin: 0; }
.filter-toggle { height: 36px; align-self: end; white-space: nowrap; }
.filter-toggle:focus-within { border-color: var(--link); box-shadow: 0 0 0 2px rgba(22, 93, 156, .12); }
.days-field input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid #cdd1d5; border-radius: 4px; color: var(--ink); background: #fff; }
.ai-option { margin-top: 23px; }
.task-start { min-width: 104px; }
.primary:disabled { cursor: wait; opacity: .55; }
.secondary { min-height: 34px; padding: 7px 14px; color: var(--ink); background: #fff; border: 1px solid #bfc4c8; border-radius: 4px; font-weight: 700; }
.secondary:hover { background: #f2f3f4; }
.task-form-error { margin: -8px 0 14px; color: #a5231c; }

.task-workspace { padding-top: 24px; padding-bottom: 32px; }
.task-monitor-head { min-height: 54px; }
.section-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.task-monitor-actions { display: flex; align-items: center; gap: 10px; }
.task-status { min-width: 72px; min-height: 27px; padding: 3px 9px; display: inline-flex; align-items: center; justify-content: center; border-radius: 3px; font-size: 12px; font-weight: 700; }
.task-status.idle { color: var(--muted); background: #e7e9eb; }
.task-status.running { color: #15583a; background: #dcefe4; }
.task-status.paused { color: #745000; background: #fff0c9; }
.task-status.success { color: #15583a; background: #dcefe4; }
.task-status.partial { color: #745000; background: #fff0c9; }
.task-status.failed { color: #8e211b; background: #f9dfdc; }
.task-meta-grid { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr 1fr 1.2fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--surface); }
.task-meta-grid > div { min-width: 0; min-height: 66px; padding: 11px 13px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.task-meta-grid span { margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.task-meta-grid strong { overflow-wrap: anywhere; font-size: 13px; }
.task-counts { display: grid; grid-template-columns: repeat(5, minmax(90px, 1fr)); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); background: #eceeef; }
.task-counts > div { min-height: 64px; padding: 9px 13px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid #d3d7da; }
.task-counts > div:last-child { border-right: 0; }
.task-counts strong { font-size: 19px; }
.task-counts span { color: var(--muted); font-size: 11px; }
.task-error-panel { margin-top: 12px; padding: 10px 12px; color: #8e211b; border-left: 3px solid #b52d25; background: #fbe9e7; overflow-wrap: anywhere; }
.log-heading { min-height: 52px; margin-top: 10px; }
.log-heading-tools { display: flex; align-items: center; gap: 12px; }
.log-heading-tools > span { min-width: 42px; color: var(--muted); font-size: 12px; text-align: right; }
.log-filter { height: 30px; display: inline-flex; overflow: hidden; border: 1px solid #bfc4c8; border-radius: 4px; background: #fff; }
.log-filter button { min-width: 58px; padding: 4px 10px; color: var(--muted); background: #fff; border-right: 1px solid #d5d8db; }
.log-filter button:last-child { border-right: 0; }
.log-filter button[aria-pressed="true"] { color: #fff; background: #343a40; }
.log-filter button:disabled { cursor: not-allowed; opacity: .42; }
.task-log { height: 410px; overflow: auto; border: 1px solid #30353a; background: #171a1d; color: #e7e9eb; font: 12px/1.55 Consolas, "Microsoft YaHei", monospace; }
.log-row { min-height: 30px; padding: 5px 10px; display: grid; grid-template-columns: 64px 58px minmax(0, 1fr); gap: 9px; border-bottom: 1px solid #292e33; }
.log-row time { color: #939ba3; }
.log-level { color: #7fb2dd; font-weight: 700; }
.log-row.warning .log-level { color: #e5ba5e; }
.log-row.error .log-level { color: #ef8178; }
.log-message { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.log-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: #8d959d; }

.task-history-band { padding: 18px 0 46px; border-top: 1px solid var(--line); background: #eceeef; }
.history-heading { min-height: 48px; }
.task-table-wrap { position: relative; min-height: 90px; overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
.task-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.task-table th, .task-table td { height: 44px; padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.task-table th { color: var(--muted); background: #f5f6f7; font-size: 11px; }
.task-table tbody tr:last-child td { border-bottom: 0; }
.table-action { padding: 4px 6px; color: var(--link); background: transparent; }
.table-action:hover { text-decoration: underline; }
.history-empty { height: 88px; display: flex; align-items: center; justify-content: center; color: var(--muted); }

.detail-shell { max-width: 1180px; margin: 0 auto; padding: 18px 24px 50px; }
.breadcrumb { display: flex; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 12px; }
.breadcrumb a { color: var(--link); text-decoration: none; }
.detail-header { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.detail-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); }
.detail-header h1 { max-width: 980px; margin: 14px 0 18px; font-size: 32px; line-height: 1.35; letter-spacing: 0; overflow-wrap: anywhere; }
.detail-actions { display: flex; align-items: center; gap: 18px; }
.link-button { display: inline-flex; align-items: center; }
.detail-shell section { padding: 26px 0; border-bottom: 1px solid var(--line); }
.detail-shell h2 { margin: 0 0 18px; font-size: 17px; }

.progress-track { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin: 0; padding: 0; list-style: none; }
.progress-track li { position: relative; min-height: 52px; padding: 25px 10px 0 0; color: var(--muted); border-top: 2px solid #cfd3d7; }
.progress-marker { position: absolute; top: -7px; left: 0; width: 12px; height: 12px; border: 2px solid #aab0b5; border-radius: 50%; background: var(--bg); }
.progress-track li.complete { color: var(--success); border-color: var(--success); }
.progress-track li.current { color: var(--ink); border-color: var(--accent); font-weight: 700; }
.progress-track li.complete .progress-marker { border-color: var(--success); background: var(--success); }
.progress-track li.current .progress-marker { border-color: var(--accent); background: var(--accent); }
.progress-track small { display: block; margin-top: 3px; color: var(--muted); font-weight: 400; }

.metadata-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.metadata-grid > div { min-width: 0; min-height: 82px; padding: 13px 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.metadata-grid > div.wide { grid-column: 1 / -1; }
.metadata-grid dt { margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.metadata-grid dd { margin: 0; overflow-wrap: anywhere; }
.preline { white-space: pre-line; }
.lots-table { border: 1px solid var(--line); background: var(--surface); }
.lot-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; }
.lot-row span { min-width: 0; padding: 11px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.lot-row span:last-child { border-right: 0; }
.lot-row:last-child span { border-bottom: 0; }
.lot-head { color: var(--muted); background: #eceeef; font-size: 12px; font-weight: 700; }
.attachment-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--surface); }
.attachment-list a { min-width: 0; padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; color: var(--link); text-decoration: none; }
.attachment-list a:nth-child(even) { border-right: 0; }
.attachment-list a span { min-width: 0; overflow-wrap: anywhere; }
.attachment-list small { flex: 0 0 auto; color: var(--muted); }
.muted { color: var(--muted); }
.attachment-list > .muted { padding: 15px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; }
.section-heading span { color: var(--muted); font-size: 12px; }
.original-section iframe { width: 100%; min-height: 720px; border: 1px solid var(--line); background: #fff; }

@media (max-width: 1260px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search-field { grid-column: span 2; }
  .filter-actions { justify-content: flex-end; }
}

@media (max-width: 1080px) {
  .result-grid { grid-template-columns: minmax(300px, 1fr) minmax(170px, 220px) 110px 100px; gap: 12px; }
  .header-meta { display: none; }
  .task-form { grid-template-columns: minmax(260px, 1fr) 110px 110px 105px auto; }
}

@media (max-width: 760px) {
  .app-header { padding: 0 14px; }
  .header-actions { gap: 0; }
  .app-nav a { min-width: 76px; padding: 0 9px; }
  .filters { padding: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-field { grid-column: 1 / -1; }
  .filter-actions { justify-content: flex-start; }
  .summary-band { padding: 12px 14px; grid-template-columns: repeat(3, 1fr); }
  .summary-band > div { padding: 4px 10px; }
  .summary-band > div:first-child { padding-left: 0; }
  .summary-band .sync-state { grid-column: 1 / -1; margin-top: 10px; padding-top: 10px; align-items: flex-start; border-top: 1px solid var(--line); }
  .results-section { padding: 8px 14px 30px; }
  .grid-header { display: none; }
  .result-grid { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .result-row { padding: 14px; }
  .notice-main { grid-column: 1 / -1; }
  .notice-source { flex-direction: row; align-items: center; }
  .result-row > span:nth-child(3) { justify-self: end; }
  .result-row time { grid-column: 1 / -1; font-size: 12px; }
  .detail-shell { padding: 14px 14px 40px; }
  .detail-header h1 { font-size: 24px; }
  .metadata-grid { grid-template-columns: 1fr; }
  .metadata-grid > div.wide { grid-column: auto; }
  .progress-track { grid-template-columns: 1fr; }
  .progress-track li { min-height: 50px; padding: 0 0 18px 25px; border-top: 0; border-left: 2px solid #cfd3d7; }
  .progress-marker { top: 0; left: -7px; }
  .lot-row { grid-template-columns: 1fr 1fr; }
  .attachment-list { grid-template-columns: 1fr; }
  .attachment-list a { border-right: 0; }
  .original-section iframe { min-height: 620px; }
  .task-shell { padding-right: 14px; padding-left: 14px; }
  .task-form { grid-template-columns: 1fr 1fr; }
  .source-selector { grid-column: 1 / -1; }
  .source-selector .check-option { flex: 1 1 0; }
  .ai-option { margin-top: 23px; }
  .task-start { width: 100%; }
  .task-meta-grid { grid-template-columns: 1fr 1fr; }
  .task-counts { grid-template-columns: repeat(5, minmax(64px, 1fr)); overflow-x: auto; }
  .task-counts > div { min-width: 74px; }
  .task-log { height: 360px; }
  .log-row { grid-template-columns: 58px 52px minmax(0, 1fr); gap: 7px; }
}

@media (max-width: 460px) {
  .filters { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .summary-band strong { font-size: 18px; }
  .detail-actions { align-items: flex-start; flex-direction: column; gap: 10px; }
  .metadata-grid > div { min-height: 70px; }
  .brand > span { display: none; }
  .app-nav a { min-width: 70px; padding: 0 6px; font-size: 13px; }
  .task-page-heading { min-height: 54px; }
  .task-form { grid-template-columns: 1fr; gap: 10px; }
  .source-selector { grid-column: auto; flex-wrap: wrap; }
  .source-selector .check-option { min-width: calc(50% - 4px); }
  .ai-option { margin-top: 0; }
  .task-monitor-head { align-items: flex-start; gap: 12px; }
  .task-monitor-actions { flex-wrap: wrap; justify-content: flex-end; }
  .log-heading { min-height: 66px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 5px; }
  .log-heading-tools { width: 100%; justify-content: space-between; }
  .log-filter { flex: 1 1 auto; }
  .log-filter button { flex: 1 1 0; min-width: 0; }
  .task-meta-grid { grid-template-columns: 1fr; }
  .task-counts { grid-template-columns: repeat(3, minmax(74px, 1fr)); }
  .task-counts > div { border-bottom: 1px solid #d3d7da; }
  .log-row { grid-template-columns: 52px minmax(0, 1fr); }
  .log-level { grid-column: 1; }
  .log-message { grid-column: 2; grid-row: 1 / span 2; }
}
