:root {
  --canvas: #f5f8fc;
  --surface: #ffffff;
  --surface-subtle: #f8faff;
  --text: #12213f;
  --muted: #66738d;
  --faint: #929db0;
  --border: #dbe3ef;
  --border-strong: #c7d2e3;
  --blue: #0969e8;
  --blue-dark: #075ac8;
  --blue-soft: #eaf3ff;
  --green: #0c9f58;
  --green-soft: #eaf8f1;
  --red: #d92d3d;
  --red-soft: #fff0f1;
  --amber: #dd7b00;
  --amber-soft: #fff5e5;
  --shadow: 0 10px 28px rgba(22, 49, 91, 0.08);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", "Noto Sans Mono CJK SC", monospace;
  --sans: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--canvas); color: var(--text); font-family: var(--sans); font-size: 14px; overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.auth-gate[hidden] { display: none; }
body.auth-pending > :not(.auth-gate), body.auth-required > :not(.auth-gate) { visibility: hidden; }
.auth-gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 25%, #eef6ff 0, #f5f8fc 46%, #edf2f8 100%); visibility: visible !important; }
.auth-card { width: min(440px, 100%); padding: 30px; border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,.98); box-shadow: 0 24px 70px rgba(20,48,88,.14); text-align: center; }
.auth-mark { width: 48px; height: 48px; color: var(--blue); stroke-width: 2.2; }
.auth-version { display: block; margin-top: 8px; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.auth-card h1 { margin: 18px 0 6px; font-size: 22px; }
.auth-card > p { min-height: 22px; margin: 0 0 16px; color: var(--muted); font-size: 12px; }
.auth-card form { text-align: left; }
.auth-card form > label { display: block; margin-bottom: 6px; color: #40506a; font-size: 11px; font-weight: 700; }
.auth-input-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.auth-input-row input { min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 9px; outline: 0; background: white; font-family: var(--mono); font-size: 12px; }
.auth-input-row input:focus { border-color: #75aef2; box-shadow: 0 0 0 3px rgba(9,105,232,.09); }
.auth-input-row button, .auth-retry { height: 42px; padding: 0 16px; border: 1px solid var(--blue); border-radius: 9px; background: var(--blue); color: white; font-weight: 700; cursor: pointer; }
.auth-card form.submitting { opacity: .65; pointer-events: none; }
.auth-card form small { display: block; margin-top: 9px; color: var(--faint); font-size: 9px; line-height: 1.55; }
.auth-retry { margin-top: 2px; }
.auth-logout { color: var(--muted); }

.app-header { height: 76px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 330px; }
.brand-mark { width: 38px; height: 38px; color: var(--blue); stroke-width: 2.2; }
.brand h1 { margin: 0; font-size: 20px; line-height: 1.2; letter-spacing: -.02em; }
.brand p { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.author-credit { display: block; margin-top: 2px; color: var(--faint); font-size: 9px; letter-spacing: .02em; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.select-field { height: 38px; display: flex; align-items: center; gap: 8px; padding-left: 10px; color: var(--muted); border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.select-field select { height: 36px; min-width: 110px; border: 0; outline: 0; color: var(--text); background: transparent; padding: 0 28px 0 0; }
.toggle { display: flex; align-items: center; gap: 8px; padding: 0 5px; color: #35425c; cursor: pointer; white-space: nowrap; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 32px; height: 18px; padding: 2px; background: #c7d1df; border-radius: 999px; transition: .2s ease; }
.toggle-track span { display: block; width: 14px; height: 14px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); transition: .2s ease; }
.toggle input:checked + .toggle-track { background: var(--blue); }
.toggle input:checked + .toggle-track span { transform: translateX(14px); }
.button { height: 38px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; white-space: nowrap; }
.button:hover { border-color: #9db3cf; background: #f9fbff; }
.button:active { transform: translateY(1px); }
.button svg { width: 17px; height: 17px; }
.button-primary { min-width: 110px; border-color: var(--blue); color: white; background: var(--blue); box-shadow: 0 6px 16px rgba(9, 105, 232, .2); }
.button-primary:hover { border-color: var(--blue-dark); background: var(--blue-dark); }

.workspace { height: calc(100vh - 76px); display: grid; grid-template-columns: minmax(390px, 46%) minmax(620px, 54%); min-height: 0; }
.input-panel, .results-panel { min-width: 0; min-height: 0; background: var(--surface); }
.input-panel { padding: 18px 16px 12px 20px; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.results-panel { padding: 18px 20px 14px 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; scrollbar-gutter: stable; }
.panel-heading, .results-heading, .detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading { margin-bottom: 12px; }
.panel-heading h2, .results-heading h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 16px; }
.panel-heading h2 svg, .results-heading h2 svg { width: 20px; height: 20px; color: var(--blue); }
.panel-heading p, .results-heading p { margin: 4px 0 0 28px; font-size: 11px; color: var(--muted); }
.input-stats { display: flex; gap: 10px; color: var(--muted); font-size: 11px; }
.input-stats span + span { padding-left: 10px; border-left: 1px solid var(--border); }

.editor-shell { position: relative; flex: 1; min-height: 220px; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-subtle); transition: .15s; }
.editor-shell:focus-within { border-color: #80b6f5; box-shadow: 0 0 0 3px rgba(9, 105, 232, .08); }
.editor-shell.dragging { border-color: var(--blue); border-style: dashed; }
textarea { width: 100%; height: 100%; resize: none; border: 0; outline: 0; padding: 18px 18px 64px; background: transparent; color: #243451; font-family: var(--mono); font-size: 12px; line-height: 1.72; tab-size: 2; white-space: pre; overflow: auto; }
textarea::placeholder { color: #9aa7ba; }
.drop-overlay { position: absolute; inset: 12px; z-index: 2; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 2px dashed #82b7f4; border-radius: 8px; background: rgba(240, 247, 255, .96); color: var(--blue); pointer-events: none; }
.editor-shell.dragging .drop-overlay { display: flex; }
.drop-overlay svg { width: 32px; height: 32px; }
.drop-overlay span { color: var(--muted); font-size: 12px; }
.input-footer { padding: 10px 4px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11px; }
.input-footer p { margin: 0; display: flex; align-items: center; gap: 7px; }
.input-footer svg { width: 16px; height: 16px; color: var(--blue); }

.results-heading { min-height: 42px; }
.results-heading p { margin-left: 28px; }
.result-tools { display: flex; gap: 8px; align-items: center; }
.search-box { height: 34px; width: 220px; display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--faint); }
.search-box:focus-within { border-color: #80b6f5; box-shadow: 0 0 0 3px rgba(9, 105, 232, .07); }
.search-box svg { width: 16px; height: 16px; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.icon-button { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; }
.icon-button:hover { color: var(--blue); border-color: #9dbbe3; background: var(--blue-soft); }
.icon-button svg { width: 17px; height: 17px; }
.button-compact { height: 34px; padding: 0 10px; font-size: 11px; font-weight: 650; }
.button-compact svg { width: 16px; height: 16px; }
.button-quiet { height: 32px; padding: 0 11px; color: var(--muted); background: #fafcff; font-size: 11px; }

.export-bar { min-height: 46px; padding: 6px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 10px; background: #fafcff; }
.export-meta { min-width: 0; flex: 1; display: grid; grid-template-columns: minmax(90px, .9fr) minmax(80px, .7fr) minmax(120px, 1.4fr); gap: 6px; }
.export-meta label { min-width: 0; height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.export-meta label:focus-within { border-color: #80b6f5; box-shadow: 0 0 0 2px rgba(9, 105, 232, .07); }
.export-meta label > span { flex: 0 0 auto; color: var(--muted); font-size: 9px; font-weight: 650; }
.export-meta input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 10px; }
.export-meta input::placeholder { color: #a1acbc; }
.export-actions { flex: 0 0 auto; display: flex; gap: 6px; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.summary-item { min-height: 60px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.summary-item span { color: var(--muted); font-size: 11px; }
.summary-item strong { font-family: var(--mono); font-size: 20px; letter-spacing: -.04em; }
.summary-valid strong { color: var(--green); }
.summary-error strong { color: var(--red); }
.summary-warning strong { color: var(--amber); }

.analysis-toolbar { min-height: 56px; padding: 9px 10px; display: grid; grid-template-columns: 180px 180px minmax(180px, 1fr) auto; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; background: #fafcff; }
.filter-control { height: 36px; display: flex; align-items: center; gap: 8px; padding-left: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.filter-control label { color: var(--muted); font-size: 10px; font-weight: 650; white-space: nowrap; }
.filter-control select { min-width: 0; flex: 1; height: 34px; border: 0; outline: 0; background: transparent; color: var(--text); font-family: var(--mono); font-size: 11px; }
.ptag-filter-control { border-color: #78aef1; background: linear-gradient(135deg, #eef6ff, #ffffff); box-shadow: inset 3px 0 var(--blue), 0 0 0 2px rgba(9, 105, 232, .06); }
.ptag-filter-control label { color: var(--blue-dark); font-weight: 800; }
.ptag-filter-control select { color: #074fae; font-weight: 750; }
.filter-description { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.filter-description strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.filter-description span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }

.observation-panel { padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #fafcff; }
.observation-panel[hidden] { display: none; }
.observation-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.observation-heading h3 { margin: 0; font-size: 13px; }
.observation-heading p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.observation-heading > span { padding: 4px 8px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); font-family: var(--mono); font-size: 10px; font-weight: 700; white-space: nowrap; }
.grouped-field-selector { max-height: 190px; display: grid; grid-template-columns: repeat(2, minmax(230px, 1fr)); align-items: start; overflow: auto; gap: 7px; padding: 2px 2px 2px 0; }
.field-group { min-width: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.field-group[open] { border-color: #b8cbe5; }
.field-group summary { min-height: 34px; padding: 7px 9px; display: flex; align-items: center; gap: 7px; color: #35445f; cursor: pointer; list-style: none; font-size: 10px; font-weight: 650; }
.field-group summary::-webkit-details-marker { display: none; }
.field-group summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: .15s; }
.field-group[open] summary::before { transform: rotate(45deg); }
.field-group summary code { color: var(--blue); font-family: var(--mono); font-size: 10px; }
.field-group summary span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-group summary em { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 9px; font-style: normal; font-weight: 500; }
.field-group-options { padding: 0 7px 7px; display: flex; flex-wrap: wrap; gap: 5px; }

.trend-panel { padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.trend-panel[hidden] { display: none; }
.trend-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.trend-heading h3 { margin: 0; font-size: 13px; }
.trend-heading p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.trend-heading > span { padding: 4px 8px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); font-family: var(--mono); font-size: 10px; font-weight: 700; white-space: nowrap; }
.chart-controls { display: flex; gap: 5px; }
.chart-controls button { width: 30px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: #43516a; font-family: var(--mono); font-size: 12px; font-weight: 700; cursor: pointer; }
.chart-controls button:hover:not(:disabled) { border-color: #91b6e8; color: var(--blue); background: var(--blue-soft); }
.chart-controls button:disabled { color: #b0b8c5; background: #f5f6f8; cursor: not-allowed; }
.field-selector { margin-top: 10px; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 3px; }
.field-selector.grouped-field-selector { display: grid; grid-template-columns: repeat(2, minmax(230px, 1fr)); align-items: start; overflow: auto; gap: 7px; padding: 2px 2px 2px 0; }
.field-option { flex: 0 0 auto; cursor: pointer; }
.field-option input { position: absolute; opacity: 0; pointer-events: none; }
.field-option span { min-height: 32px; padding: 4px 9px; display: inline-flex; align-items: flex-start; justify-content: center; flex-direction: column; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: #42516c; font-size: 10px; transition: .15s ease; }
.field-option b { font-weight: 650; }
.field-option small { margin-top: 1px; color: var(--muted); font-family: var(--mono); font-size: 8px; }
.field-option small em { margin-left: 5px; color: #7f8ba0; font-style: normal; }
.field-option:hover span { border-color: #9ab9e2; background: #f8fbff; }
.field-option input:checked + span { border-color: #86b7f3; background: var(--blue-soft); color: var(--blue); box-shadow: inset 0 0 0 1px rgba(9, 105, 232, .08); }
.field-option.disabled { cursor: not-allowed; }
.field-option.disabled span { color: #a5adba; background: #f5f6f8; opacity: .7; }
.chart-wrap { position: relative; min-height: 210px; margin-top: 8px; overflow: hidden; border: 1px solid #e5eaf2; border-radius: 8px; background: #ffffff; }
.chart-wrap canvas { display: block; width: 100%; height: 210px; cursor: crosshair; }
.chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; pointer-events: none; }
.chart-empty[hidden] { display: none; }
.chart-tooltip { position: absolute; z-index: 3; width: 210px; padding: 8px 9px; border: 1px solid var(--border-strong); border-radius: 7px; background: rgba(255, 255, 255, .97); box-shadow: var(--shadow); color: var(--text); font-size: 10px; pointer-events: none; }
.chart-tooltip time { display: block; margin-bottom: 6px; color: var(--muted); font-family: var(--mono); }
.chart-tooltip span { display: grid; grid-template-columns: 7px 1fr auto; align-items: center; gap: 6px; padding: 2px 0; }
.chart-tooltip i, .chart-legend i { width: 7px; height: 7px; border-radius: 50%; }
.chart-tooltip strong { font-family: var(--mono); }
.chart-legend { min-height: 21px; display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 8px 3px 0; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; }
.chart-legend strong { font-family: var(--mono); }
.chart-legend em { color: var(--muted); font-family: var(--mono); font-style: normal; }
.chart-pan-control { min-height: 26px; display: grid; grid-template-columns: auto 1fr 34px; align-items: center; gap: 8px; padding-top: 5px; color: var(--muted); font-size: 9px; }
.chart-pan-control input { width: 100%; accent-color: var(--blue); cursor: ew-resize; }
.chart-pan-control input:disabled { cursor: not-allowed; opacity: .45; }
.chart-pan-control output { color: var(--blue); font-family: var(--mono); font-weight: 700; text-align: right; }

.table-shell { position: relative; flex: 0 0 auto; height: 300px; min-height: 190px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 11px; }
thead { position: sticky; top: 0; z-index: 1; background: #f7f9fc; box-shadow: inset 0 -1px var(--border); }
th { height: 34px; padding: 0 8px; color: #4b5871; text-align: left; font-weight: 650; white-space: nowrap; }
td { height: 38px; padding: 6px 8px; border-bottom: 1px solid #edf1f7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
th:nth-child(1), td:nth-child(1) { width: 36px; text-align: center; }
th:nth-child(2), td:nth-child(2) { width: 116px; }
th:nth-child(3), td:nth-child(3) { width: 112px; }
th:nth-child(4), td:nth-child(4) { width: 56px; font-family: var(--mono); }
th:nth-child(5), td:nth-child(5) { width: 126px; }
th:nth-child(7), td:nth-child(7) { width: 88px; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: #f8fbff; }
tbody tr.selected { background: var(--blue-soft); box-shadow: inset 3px 0 var(--blue); }
tbody tr.invalid { background: #fff9f9; }
tbody tr.invalid.selected { background: var(--red-soft); box-shadow: inset 3px 0 var(--red); }
tbody tr.jump-highlight { animation: row-jump-highlight 1.15s ease; }
@keyframes row-jump-highlight { 0%, 100% { outline: 0 solid transparent; } 25%, 55% { outline: 3px solid rgba(9, 105, 232, .48); outline-offset: -3px; background: #ddebff; } }
.direction-device { color: var(--blue); font-weight: 600; }
.ptag { color: #23395f; font-weight: 700; }
.key-data { font-family: var(--mono); color: #335174; }
.status { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent); }
.status-valid { color: var(--green); }
.status-invalid { color: var(--red); }
.dynamic-table { table-layout: fixed; }
.dynamic-table th:nth-child(n), .dynamic-table td:nth-child(n) { width: 142px; text-align: left; }
.dynamic-table th:first-child, .dynamic-table td:first-child { position: sticky; left: 0; z-index: 2; width: 44px; text-align: center; background: inherit; }
.dynamic-table th:nth-child(2), .dynamic-table td:nth-child(2) { position: sticky; left: 44px; z-index: 2; width: 158px; background: inherit; box-shadow: 1px 0 #e2e8f1; }
.dynamic-table th:last-child, .dynamic-table td:last-child { width: 84px; }
.dynamic-table thead th:first-child, .dynamic-table thead th:nth-child(2) { z-index: 4; background: #f7f9fc; }
.dynamic-table.group-table th:first-child, .dynamic-table.group-table td:first-child { width: 158px; text-align: left; }
.dynamic-table.group-table th:nth-child(2), .dynamic-table.group-table td:nth-child(2) { left: 158px; width: 190px; }
.dynamic-table thead th { height: 46px; }
.dynamic-table thead th > span { display: block; overflow: hidden; text-overflow: ellipsis; }
.dynamic-table thead th > small { display: block; margin-top: 2px; overflow: hidden; color: var(--muted); font-family: var(--mono); font-size: 8px; font-weight: 500; text-overflow: ellipsis; }
.dynamic-table tbody tr { background: var(--surface); }
.dynamic-table tbody tr:hover { background: #f8fbff; }
.dynamic-table tbody tr.selected { background: var(--blue-soft); }
.dynamic-table tbody tr.invalid { background: #fff9f9; }
.dynamic-table tbody tr.invalid.selected { background: var(--red-soft); }
.field-value { font-family: var(--mono); color: #26466f; }
.empty-state { position: absolute; inset: 34px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.empty-state svg { width: 54px; height: 54px; color: #9fb2cb; }
.empty-state h3 { margin: 12px 0 5px; font-size: 14px; color: #394863; }
.empty-state p { margin: 0; max-width: 320px; font-size: 11px; line-height: 1.6; }
.empty-state[hidden] { display: none; }

.detail-panel { flex: 0 0 auto; height: 360px; min-height: 210px; overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.detail-heading { min-height: 44px; padding: 0 12px 0 14px; border-bottom: 1px solid var(--border); background: #fafcff; }
.detail-heading h3 { margin: 0; font-size: 13px; }
.detail-heading p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.detail-heading .icon-button { width: 30px; height: 30px; }
.detail-content { padding: 12px; overflow: auto; }
.detail-placeholder { margin: 40px 0; color: var(--muted); text-align: center; }
.detail-grid { display: grid; grid-template-columns: minmax(180px, .9fr) minmax(270px, 1.25fr) minmax(210px, .95fr); gap: 10px; }
.detail-card { min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.detail-card h4 { margin: 0 0 9px; font-size: 11px; color: #43516a; }
.detail-meta { display: grid; grid-template-columns: auto 1fr; gap: 7px 10px; margin-bottom: 10px; font-size: 11px; }
.detail-meta dt { color: var(--muted); }
.detail-meta dd { margin: 0; font-weight: 600; }
.raw-frame { margin: 0; padding: 9px; overflow-wrap: anywhere; border-radius: 6px; background: #f3f6fa; color: #243651; font-family: var(--mono); font-size: 10px; line-height: 1.7; }
.raw-frame mark { padding: 1px 2px; background: #fff0bf; color: #6d4a00; border-radius: 3px; }
.fields-table { width: 100%; table-layout: auto; font-size: 10px; }
.fields-table th, .fields-table td { height: auto; padding: 5px 7px; white-space: normal; vertical-align: top; }
.fields-table th:nth-child(n), .fields-table td:nth-child(n) { width: auto; text-align: left; }
.fields-table td:nth-child(2) { font-family: var(--mono); color: var(--muted); }
.fields-table td:nth-child(3) { font-weight: 650; color: #183a69; }
.fields-table td:nth-child(4) { font-family: var(--mono); color: var(--muted); }
.checksum-box { display: flex; flex-direction: column; gap: 9px; font-size: 11px; line-height: 1.55; }
.checksum-formula { padding: 10px; border-radius: 7px; background: #f5f8fc; font-family: var(--mono); color: #334866; overflow-wrap: anywhere; }
.checksum-result { padding: 9px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-radius: 7px; font-weight: 700; }
.checksum-result.valid { background: var(--green-soft); color: var(--green); border: 1px solid #bce9d2; }
.checksum-result.invalid { background: var(--red-soft); color: var(--red); border: 1px solid #f3c7cc; }
.warning-list { margin: 0; padding-left: 18px; color: var(--red); }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 10; padding: 10px 14px; transform: translate(-50%, 14px); border-radius: 8px; background: #15243e; color: white; box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1180px) {
  .app-header { padding: 0 16px; }
  .brand { min-width: 280px; }
  .brand p { display: none; }
  .header-actions { gap: 6px; }
  .button { padding: 0 10px; }
  .button-ghost { font-size: 0; width: 38px; padding: 0; }
  .button-ghost svg { width: 18px; height: 18px; }
  .button-compact { width: 34px; padding: 0; }
  .button-compact span { display: none; }
  .toggle > span:last-child { display: none; }
  .workspace { grid-template-columns: minmax(340px, 42%) minmax(570px, 58%); }
  .detail-grid { grid-template-columns: minmax(170px, .8fr) minmax(260px, 1.2fr); }
  .detail-card:last-child { grid-column: 1 / -1; }
  .analysis-toolbar { grid-template-columns: 160px 160px minmax(150px, 1fr) auto; }
  .export-meta { grid-template-columns: minmax(110px, .8fr) minmax(95px, .7fr) minmax(140px, 1fr); }
}

@media (min-width: 821px) and (max-width: 1350px) {
  .detail-grid { grid-template-columns: minmax(170px, .8fr) minmax(270px, 1.2fr); }
  .detail-card:last-child { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  body { overflow: auto; }
  .app-header { height: auto; min-height: 68px; padding: 12px 14px; align-items: flex-start; flex-wrap: wrap; }
  .brand { min-width: 0; }
  .brand-mark { width: 32px; height: 32px; }
  .brand h1 { font-size: 17px; }
  .header-actions { width: 100%; justify-content: flex-start; overflow-x: auto; padding-bottom: 2px; }
  .select-field { padding-left: 8px; }
  .select-field > span { display: none; }
  .select-field select { min-width: 104px; }
  .button-primary { width: 38px; min-width: 38px; padding: 0; font-size: 0; }
  .button-primary svg { width: 18px; height: 18px; }
  .workspace { height: auto; display: block; }
  .input-panel, .results-panel { min-height: 640px; padding: 14px; border-right: 0; border-bottom: 1px solid var(--border); }
  .editor-shell { min-height: 500px; }
  .results-panel { gap: 10px; }
  .results-heading { align-items: flex-start; }
  .result-tools { flex-wrap: wrap; justify-content: flex-end; }
  .search-box { width: 170px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .export-bar { align-items: stretch; flex-direction: column; }
  .export-meta { grid-template-columns: 1fr 1fr; }
  .export-description { grid-column: 1 / -1; }
  .export-actions { justify-content: flex-end; }
  .analysis-toolbar { grid-template-columns: 1fr 1fr; }
  .filter-control { grid-column: auto; }
  .filter-description { grid-column: 1 / -1; }
  .filter-description span { white-space: normal; }
  .field-selector.grouped-field-selector { grid-template-columns: 1fr; max-height: 240px; }
  .table-shell { height: 360px; min-height: 360px; }
  table { min-width: 850px; }
  .trend-panel { padding: 10px; }
  .chart-wrap, .chart-wrap canvas { height: 210px; }
  .detail-panel { height: 480px; min-height: 480px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-card:last-child { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
