:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  font-size: 100%;
  color: #142537;
  background: #f3f6fa;
  --dark: #142537;
  --muted: #526477;
  --line: #d9e2ec;
  --light: #f4f7fa;
  --accent: #0b5ca6;
  --accent-hover: #074984;
  --error: #9b352c;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.6; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.25rem, 2vw, 1.65rem); line-height: 1.35; }
h2 { font-size: 1.35rem; line-height: 1.3; }
h3 { font-size: 1.03rem; }
button, input, select { font: inherit; }
button, input, select { border: 1px solid #aebed0; border-radius: .4rem; }
button {
  min-height: 2.55rem;
  padding: .35rem .9rem;
  color: var(--dark);
  background: #fff;
  cursor: pointer;
  font-size: .93rem;
  white-space: nowrap;
}
button:hover:not(:disabled) { border-color: var(--accent); background: #f4f9ff; }
button:disabled, select:disabled { cursor: default; opacity: .58; }
:focus-visible { outline: 3px solid #1680d0; outline-offset: 3px; }
input, select {
  display: block;
  width: 100%;
  min-height: 2.62rem;
  padding: .43rem .63rem;
  color: var(--dark);
  background-color: #fff;
}
select {
  appearance: none;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, #47596d 51%),
    linear-gradient(135deg, #47596d 50%, transparent 51%);
  background-position: calc(100% - .91rem) center, calc(100% - .59rem) center;
  background-size: .32rem .32rem;
  background-repeat: no-repeat;
}
input[type="checkbox"], input[type="radio"] { width: 1.1rem; min-height: 1.1rem; margin: 0; accent-color: var(--accent); }
input[type="file"] { max-width: 100%; padding: .35rem; font-size: .92rem; }
label { display: block; font-weight: 600; font-size: .93rem; }
a { color: var(--accent); overflow-wrap: anywhere; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 650; }
.primary:hover:not(:disabled) { color: #fff; background: var(--accent-hover); border-color: var(--accent-hover); }
.muted { color: var(--muted); }
.helper { font-size: .875rem; }
.message { color: var(--accent); font-size: .92rem; overflow-wrap: anywhere; }
.message:empty { display: none; }
.message.error { color: var(--error); }

.login-view { display: grid; min-height: 100vh; place-items: center; padding: 1.4rem; }
.login-panel { width: min(100%, 31rem); padding: clamp(1.25rem, 5vw, 2.65rem); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: .7rem; background: #fff; box-shadow: 0 .8rem 2.5rem rgb(20 37 55 / 6%); }
.login-panel form { display: grid; gap: .65rem; margin-top: 1.6rem; }
.login-panel .primary { justify-self: start; margin-top: .28rem; }
.login-panel > p { margin-top: .55rem; }

.site-header { background: #fff; border-top: 3px solid var(--accent); border-bottom: 1px solid var(--line); }
.header-content, .workspace { width: min(100%, 101rem); margin-inline: auto; padding-inline: clamp(1rem, 3vw, 2.5rem); }
.header-content { display: flex; align-items: center; justify-content: space-between; gap: .8rem 1.2rem; flex-wrap: wrap; padding-block: 1.1rem; }
.header-actions, .task-actions, .output-actions, .form-actions, .inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.header-actions > span { margin-right: .3rem; font-size: .93rem; }
.workspace { padding-block: 1.5rem 3rem; }
.task-bar { display: flex; align-items: end; justify-content: space-between; gap: .75rem 1.5rem; flex-wrap: wrap; padding: .9rem 1.15rem; border: 1px solid var(--line); border-radius: .55rem; background: #fff; }
.task-picker { flex: 1 1 17rem; max-width: 33rem; }
.task-picker label { margin-bottom: .28rem; }
.task-bar + .message { margin-top: .55rem; }
.columns { display: grid; grid-template-columns: minmax(0, .94fr) minmax(0, 1.23fr) minmax(0, 1.05fr); gap: 1rem; margin-top: 1rem; align-items: start; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: .62rem; background: #fff; overflow: hidden; }
.panel-header { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); background: #f7f9fc; }
.panel-header h2 { color: var(--accent); }
.panel-header span { color: var(--muted); font-size: .88rem; }
.panel-body { padding: 1rem; }
.field + .field { margin-top: 1rem; }
.field label { margin-bottom: .25rem; }
#suitability-button { margin-top: .7rem; }
.section-divider { margin: 1rem 0 .75rem; border-top: 1px solid var(--line); }
.config-item { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .55rem 0; }
.config-item + .config-item { border-top: 1px solid var(--line); }
.config-item p { margin-top: .16rem; font-size: .87rem; }
#catalog-note, #output-note { margin-top: .55rem; }

.run-actions { display: flex; align-items: center; gap: .8rem; min-height: 2.6rem; }
.run-actions .primary { min-width: 6.1rem; }
.run-actions p { font-size: .9rem; overflow-wrap: anywhere; }
.animation { margin-top: 1.18rem; }
.animation h3 { margin-bottom: .45rem; }
.animation-stage { display: grid; min-height: 12rem; aspect-ratio: 16 / 10; place-items: center; width: 100%; border: 1px solid var(--line); border-radius: .45rem; background: var(--light); overflow: hidden; }
.animation-stage p { padding: 1rem; text-align: center; font-size: .9rem; }
.animation-stage img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.animation figcaption, #animation-caption { margin-top: .43rem; }
.result-list { display: grid; gap: .55rem; }
.result-item { padding: .62rem .7rem; border: 1px solid var(--line); border-radius: .4rem; min-width: 0; }
.result-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .26rem .75rem; }
.result-row strong { font-size: .94rem; font-weight: 650; }
.result-status { color: var(--muted); font-size: .85rem; }
.result-status.available { color: #0a6345; font-weight: 650; }
.result-status.error { color: var(--error); }
.result-item p { margin-top: .19rem; font-size: .86rem; overflow-wrap: anywhere; }
.sensor-subresults { display: grid; gap: .35rem; margin-top: .4rem; }
.sensor-subresults > div { border-top: 1px solid var(--line); padding-top: .35rem; }
.sensor-subresults summary { cursor: pointer; font-size: .89rem; }
.output-actions { margin-top: .85rem; }
.indicator-choices { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.indicator-choices button[aria-pressed="true"] { background: #eef6ff; color: var(--accent-hover); border-color: var(--accent); font-weight: 650; }
#indicator-group-panel { max-height: min(62dvh, 34rem); overflow: auto; }
:is(.indicator-table, .combination-table) { width: 100%; border-spacing: 0; font-size: .92rem; }
.indicator-table caption { font-weight: 650; padding-bottom: .45rem; text-align: left; }
:is(.indicator-table, .combination-table) thead { position: sticky; top: 0; background: #eef4fa; }
:is(.indicator-table, .combination-table) :is(th, td) { padding: .38rem .55rem; border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: anywhere; }
.indicator-table tbody th { font-weight: 500; }
.indicator-table .indicator-group { background: #f6f9fc; font-weight: 650; }
.indicator-table .indicator-level-1 { padding-inline-start: 1.05rem; }
.indicator-table .indicator-level-2 { padding-inline-start: 1.65rem; }
.indicator-table .indicator-level-3 { padding-inline-start: 2.25rem; }
.indicator-status { width: 7rem; color: var(--muted); }
.indicator-score { width: 5rem; font-variant-numeric: tabular-nums; }
.combination-note { margin-bottom: .5rem; }
.combination-panel { max-height: min(62dvh, 34rem); overflow: auto; }
.combination-table { min-width: 37rem; }
.combination-table thead { z-index: 2; }
.combination-table :is(th, td):not(:first-child) { text-align: center; min-width: 4.5rem; }
.combination-table th:first-child { position: sticky; left: 0; z-index: 1; min-width: 9rem; max-width: 13rem; background: #fff; border-right: 1px solid var(--line); }
.combination-table thead th:first-child { background: #eef4fa; }
.combination-check { color: #0a6345; font-weight: 650; }

dialog { width: min(46rem, calc(100% - 1.5rem)); max-height: calc(100% - 1.6rem); padding: 0; color: var(--dark); background: #fff; border: 1px solid var(--line); border-radius: .65rem; box-shadow: 0 .8rem 2.2rem rgb(19 39 63 / 18%); }
dialog.wide { width: min(66rem, calc(100% - 1.5rem)); }
dialog::backdrop { background: rgb(19 34 52 / 55%); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); background: #f8fafc; }
.dialog-header button { min-height: 2.2rem; }
.dialog-content { padding: 1.1rem; }
.dialog-message { padding: 0 1.1rem 1rem; }
.stack { display: grid; gap: .75rem; }
.checkbox-line { display: flex; gap: .55rem; align-items: center; }
.audit-group { min-width: 0; margin: 0; padding: .55rem .85rem .75rem; border: 1px solid var(--line); border-radius: .5rem; }
.audit-group legend { max-width: 100%; padding: 0 .35rem; font-weight: 650; }
.audit-criteria { display: grid; gap: .42rem; }
.audit-grade { margin-inline-start: .6rem; color: var(--muted); font-size: .88rem; font-weight: 550; white-space: nowrap; }
.audit-grade output { color: var(--dark); font-variant-numeric: tabular-nums; }
.form-actions { justify-content: end; margin-top: .3rem; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.upload-row, .history-row, .catalog-row { display: grid; gap: .35rem; align-items: center; }
.upload-row { padding: .69rem 0; border-bottom: 1px solid var(--line); }
.ref-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.ref-list li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.ref-list button, .catalog-row button, .history-row button { min-height: 2.15rem; }
.ref-info { min-width: 0; }
.ref-info > a { margin-right: .36rem; }
.history-row { grid-template-columns: minmax(0, 1fr) auto; padding: .6rem; border: 1px solid var(--line); border-radius: .4rem; }
.history-meta { overflow-wrap: anywhere; }
.catalog-section, .plot-panel { padding: .8rem; border: 1px solid var(--line); border-radius: .4rem; background: #fafbfd; }
.catalog-row { grid-template-columns: minmax(0, 1fr) auto; padding: .5rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.catalog-entry { display: grid; gap: .5rem; margin-top: .6rem; }
.catalog-entry > button { justify-self: start; }
.plot-panel { display: grid; grid-template-columns: minmax(10.5rem, .8fr) minmax(0, 1.25fr); gap: 1rem; }
.plot-panel > h3 { grid-column: 1 / -1; }
.plot-empty { display: grid; min-height: 8rem; place-content: center; padding: .75rem; border: 1px solid var(--line); border-radius: .35rem; background: #fff; text-align: center; }
.plot-options, .plot-results { display: grid; gap: .6rem; align-content: start; }
.plot-options .field-grid { gap: .5rem; }

@media (max-width: 65rem) {
  .columns { grid-template-columns: minmax(0, .9fr) minmax(0, 1.05fr) minmax(0, 1fr); gap: .7rem; }
  .panel-header, .panel-body { padding-inline: .78rem; }
  .animation-stage { min-height: 9.6rem; }
}
@media (max-width: 52rem) {
  .columns { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .panel:last-child { grid-column: 1 / -1; }
}
@media (max-width: 37rem) {
  .columns { grid-template-columns: minmax(0, 1fr); }
  .panel:last-child { grid-column: auto; }
  .task-bar { padding-inline: .7rem; }
  .indicator-status { width: 6rem; }
  .indicator-score { width: 3.4rem; }
  .plot-panel, .field-grid { grid-template-columns: minmax(0, 1fr); }
}
