@import url("../css/typography.css");
:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #102a43;
  --muted: #486581;
  --weak: #5d7288;
  --line: #d9e2ec;
  --line-strong: #c3d4e4;
  --cyan: #0a5382;
  --cyan-2: #1565c0;
  --cyan-soft: #e8f3f8;
  --danger: #dc2626;
  --warn: #f59e0b;
  --fs-h1: 28px;
  --fs-h2: 18px;
  --fs-body: 14px;
  --fs-meta: 12px;
}

* { box-sizing: border-box; }

body {
  min-width: 960px;
  margin: 0;
  min-height: 100vh;
  font-family:var(--font-app);
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(147, 197, 216, 0.22), transparent 34%),
    linear-gradient(160deg, rgba(232, 200, 156, 0.10), transparent 36%),
    linear-gradient(180deg, #f8fbfd 0%, var(--bg) 100%);
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }

[hidden] { display: none !important; }
.parameter-tools { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; margin: 12px 0 20px; background: #eef6fa; border: 1px solid #cddfe9; border-radius: 10px; }
.parameter-tools label { display: grid; gap: 6px; flex: 1 1 250px; font-size: 13px; }
.parameter-tools p { margin: 0; flex-basis: 100%; font-size: 12px; color: #546a7b; }
.parameter-tools input, .field-item textarea { width: 100%; padding: 10px 12px; border: 1px solid #bbcfdd; border-radius: 7px; background: white; color: #173b53; }
.parameter-tools button, .figure-tools button, .table-download, .figure-dialog button { border: 1px solid #bdd0de; background: #fff; color: #0a5382; padding: 8px 12px; border-radius: 7px; cursor: pointer; }
.field-wide { grid-column: 1 / -1; }
.field-item textarea { resize: vertical; min-height: 110px; font-family:var(--font-app); }
[aria-invalid="true"] { border-color: #ce3535 !important; background: #fff8f8 !important; }
button:disabled { opacity: .5; cursor: not-allowed; }
.figure-tools { display: flex; justify-content: flex-end; gap: 8px; margin: 8px 0; }
.figure-dialog { width: min(96vw, 1680px); max-width: 96vw; max-height: 94vh; border: 1px solid #acc6d8; border-radius: 14px; padding: 20px; background: #fff; }
.figure-dialog::backdrop { background: #102a4377; }
.figure-dialog .chart { width: 100%; max-height: 78vh; }
.table-download { margin-bottom: 8px; font-size: 12px; }
.calculation-process { padding: 18px; margin-top: 16px; background: #f3f8fb; border: 1px solid #cddfe9; border-radius: 10px; }
.calculation-process summary { cursor: pointer; font-weight: 700; color: #0a5382; }
.calculation-process pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.8 var(--font-app); max-height: 640px; overflow: auto; }
.result-card-wrap:not(.has-result) .result:not(:has(.result-empty)) { opacity: .45; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(10, 83, 130, 0.20);
  outline-offset: 2px;
}

.shell,
.page {
  width: min(1760px, calc(100vw - 40px));
  max-width: none;
  margin: 0 auto;
  padding: 18px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.back {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--cyan);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 700;
}

.meta {
  color: var(--weak);
  font-size: var(--fs-meta);
  line-height: 1.45;
}

.hero,
.panel,
.card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 42px rgba(16, 42, 67, 0.07);
}

.hero {
  padding: 20px 24px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -10% 0 10%;
  height: 70px;
  border-top: 1px solid rgba(10, 83, 130, 0.10);
  transform: rotate(-3deg);
  pointer-events: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  color: var(--cyan);
  background: #e8f3f8;
  border: 1px solid #c7ddeb;
  border-radius: 999px;
  padding: 5px 10px;
  font-family:var(--font-app);
  font-size: var(--fs-meta);
  font-weight: 700;
}

.program-id {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 12px 0 0;
  color: var(--cyan);
  background: #e8f3f8;
  border: 1px solid #c7ddeb;
  border-radius: 999px;
  padding: 5px 10px;
  font-family:var(--font-app);
  font-size: var(--fs-meta);
  font-weight: 800;
}

h1 {
  margin: 8px 0 6px;
  font-size: var(--fs-h1);
  line-height: 1.3;
  text-wrap: balance;
}

.desc {
  margin: 0;
  max-width: 860px;
  color: var(--muted);
  font-size: var(--fs-body);
  line-height: 1.7;
  text-wrap: pretty;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel,
.card { padding: 18px; }

.input-card,
.result-card-wrap {
  width: 100%;
}

.is-rain-flood-profile .page {
  width: min(1840px, calc(100vw - 36px));
}

.is-rain-flood-profile .layout {
  grid-template-columns: minmax(0, 1fr);
}

.is-rain-flood-profile .result-card-wrap {
  min-height: 520px;
}

.method-reference {
  border: 1px solid #c7ddeb;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(232, 243, 248, 0.92), rgba(255, 255, 255, 0.98) 52%),
    #fff;
  margin-bottom: 14px;
  padding: 16px;
}

.method-ref-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 12px;
}

.method-ref-head strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
}

.method-ref-head p,
.method-warning {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.method-status {
  flex: 0 0 auto;
  border: 1px solid #f5c66d;
  border-radius: 999px;
  background: #fffbeb;
  color: #92400e;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.rainfall-mode-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.rainfall-mode-tabs button {
  border: 1px solid #c7ddeb;
  border-radius: 999px;
  background: #fff;
  color: var(--cyan);
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 800;
}

.rainfall-mode-tabs button.is-active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #fff;
}

.rainfall-mode-tabs button:disabled {
  cursor: not-allowed;
  color: #8aa1b7;
  background: #f3f7fa;
}

.method-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
}

.method-steps article {
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 12px;
  background: rgba(255,255,255,0.86);
  padding: 12px;
}

.method-steps b {
  display: block;
  margin-bottom: 5px;
  color: var(--cyan);
  font-size: 13px;
}

.method-steps span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.method-warning {
  border-top: 1px solid rgba(16, 42, 67, 0.08);
  margin-top: 12px;
  padding-top: 10px;
  color: #78350f;
}

.region-context {
  margin: 0 0 16px;
  border: 1px solid #c7ddeb;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(232, 243, 248, 0.86), rgba(255, 255, 255, 0.98) 52%),
    #fff;
  padding: 14px 16px;
  box-shadow: 0 14px 30px rgba(16, 42, 67, 0.06);
}

.region-context.is-pending {
  border-color: #f5c66d;
  background:
    linear-gradient(135deg, rgba(255, 251, 235, 0.92), rgba(255, 255, 255, 0.98) 58%),
    #fff;
}

.region-context > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.region-context strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
}

.region-context span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
}

.region-context-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.region-context-grid section {
  border: 1px solid rgba(217, 226, 236, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  padding: 10px 12px;
}

.region-context-grid b {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 13px;
}

.region-context-grid ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.region-context-link {
  display: inline-flex;
  margin-top: 10px;
  border: 1px solid #f5c66d;
  border-radius: 999px;
  background: #fff7ed;
  color: #92400e;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

body.is-region-blocked .input-card .primary {
  cursor: not-allowed;
  background: #90a4ae;
  border-color: #90a4ae;
  color: #fff;
}

.result-card-wrap {
  min-height: 420px;
}

.result-card-wrap.has-result {
  min-height: 620px;
}

.panel h2,
.card h2 {
  margin: 0 0 14px;
  font-size: var(--fs-h2);
  line-height: 1.35;
  border-left: 6px solid var(--cyan);
  padding-left: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.param-group {
  border: 1px solid #d8e6ef;
  border-radius: 12px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(232, 243, 248, 0.78), rgba(255, 255, 255, 0.98) 48%),
    #fff;
}

.param-group-header {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(16, 42, 67, 0.08);
}

.param-group-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
}

.param-group-header p {
  margin: 0;
  max-width: 1120px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  text-wrap: pretty;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
}

.field-item {
  display: grid;
  align-content: start;
  min-height: 106px;
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.92);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.field-item:focus-within {
  border-color: rgba(10, 83, 130, 0.70);
  box-shadow: 0 10px 22px rgba(16, 42, 67, 0.08);
}

.field-item span {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
  text-wrap: pretty;
}

.field-control {
  position: relative;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  min-height: 34px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.field-control:has(.field-unit) input,
.field-control:has(.field-unit) select {
  padding-right: 54px;
}

.field-unit {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #8aa1b7;
  font-family:var(--font-app);
  font-size: 11px;
  pointer-events: none;
  white-space: nowrap;
}

input::placeholder {
  color: #8aa1b7;
}

input:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(10, 83, 130, 0.10);
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px solid rgba(16, 42, 67, 0.08);
  position: sticky;
  bottom: 0;
  z-index: 4;
  background: linear-gradient(180deg, rgba(255,255,255,0.88), #fff 38%);
}

.primary,
.secondary,
.actions button {
  border: 1px solid var(--cyan);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 800;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.primary { background: var(--cyan); color: #fff; }
.primary:hover { background: #0d47a1; }
.secondary { background: #fff; color: var(--cyan); }
.secondary:hover { background: #e8f3f8; }

.notice {
  margin-top: 12px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.6;
  min-height: 22px;
}

.dependency-warning { margin-bottom: 14px; }

.dependency-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--warn);
  border-left: 6px solid var(--warn);
  border-radius: 14px;
  background: #fffbeb;
  color: #78350f;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
}

.dependency-action {
  justify-self: start;
  border: 1px solid #d97706;
  border-radius: 10px;
  background: #fff7ed;
  color: #92400e;
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 800;
}

.is-blocked .form-grid {
  opacity: 0.45;
  filter: grayscale(0.1);
}

.primary:disabled {
  background: #90a4ae;
  border-color: #90a4ae;
  cursor: not-allowed;
}

.result-empty {
  border: 1px dashed #b7cde0;
  border-radius: 12px;
  padding: 56px 30px;
  color: var(--weak);
  text-align: center;
  line-height: 1.6;
  background:
    linear-gradient(135deg, rgba(232, 243, 248, 0.78), transparent 52%),
    linear-gradient(180deg, #ffffff, #f7fbfe);
}

.result-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.result-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #c7ddeb;
  border-radius: 999px;
  background: #e8f3f8;
  color: var(--cyan);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.kpi-card {
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  background:
    linear-gradient(180deg, #ffffff, #f7fbfe);
  padding: 14px;
  min-height: 128px;
}

.kpi-card span,
.kpi-card small {
  display: block;
  color: var(--weak);
  font-size: 12px;
  line-height: 1.45;
}

.kpi-card strong {
  display: block;
  margin: 7px 0 3px;
  color: var(--cyan);
  font-size: 24px;
  line-height: 1.2;
}

.kpi-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.atlas-chart-board {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.72);
  padding: 16px;
  margin-bottom: 16px;
}

.atlas-board-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(16, 42, 67, 0.08);
  padding-bottom: 10px;
}

.atlas-board-head h3 {
  margin: 0;
  font-size: 16px;
}

.atlas-board-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.atlas-chart-card {
  margin-bottom: 14px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 18px;
  height: 3px;
  border-radius: 999px;
}

.result-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(16, 42, 67, 0.08);
  padding-bottom: 10px;
}

.result-toolbar h3 {
  margin: 0;
}

.result-meta {
  color: var(--weak);
  font-size: 12px;
  white-space: nowrap;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  table-layout: fixed;
  font-size: 13px;
  line-height: 1.5;
  background: #fff;
}

th,
td {
  border: 1px solid rgba(217, 226, 236, 0.95);
  padding: 9px 10px;
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
}

th {
  background: linear-gradient(180deg, #eef7fb, #e2eff7);
  color: var(--text);
  font-weight: 800;
}

tbody tr:nth-child(even) td {
  background: #fbfdff;
}

tbody tr:hover td {
  background: #f1f8fc;
}

td:nth-child(2),
.mono {
  font-family:var(--font-app);
  font-variant-numeric: tabular-nums;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
  background: #fff;
  overflow-x: auto;
  box-shadow: 0 12px 26px rgba(16, 42, 67, 0.05);
}

.contract-card {
  background:
    linear-gradient(135deg, rgba(232, 243, 248, 0.72), transparent 54%),
    #fff;
}

.contract-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 6px;
}

.contract-grid span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #c3d4e4;
  border-radius: 999px;
  background: #f7fbfe;
  color: #102a43;
  padding: 7px 12px;
  font-size: 12px;
  line-height: 1.35;
}

.contract-grid strong {
  color: #486581;
  font-weight: 600;
}

.diag-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.diag-list li {
  position: relative;
  padding: 8px 10px 8px 28px;
  border: 1px solid rgba(195, 212, 228, 0.78);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: #334e68;
  line-height: 1.55;
}

.diag-list li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 15px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #0a5382;
}

.result-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.35;
}

.chart-card {
  overflow: hidden;
}

.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.chart-title {
  display: grid;
  gap: 4px;
}

.chart-title h3 {
  margin: 0;
  font-size: 15px;
}

.chart-title span,
.chart-range {
  color: var(--weak);
  font-size: 12px;
  line-height: 1.45;
}

.chart {
  width: 100%;
  min-height: 340px;
  height: clamp(340px, 32vw, 460px);
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f7fbfe);
  margin-top: 12px;
}

.chart text {
  font-family:var(--font-app);
  paint-order: stroke;
  stroke: rgba(255,255,255,0.85);
  stroke-width: 2px;
}

.chart .mono-text {
  font-family:var(--font-app);
  font-variant-numeric: tabular-nums;
}

.water-summary-card {
  background:
    linear-gradient(135deg, rgba(232, 243, 248, 0.82), transparent 54%),
    linear-gradient(180deg, #ffffff, #f9fcff);
}

.water-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.water-kpi-card {
  min-height: 116px;
  border: 1px solid rgba(195, 212, 228, 0.92);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.water-kpi-card span,
.water-kpi-card small {
  display: block;
  color: var(--weak);
  font-size: 12px;
  line-height: 1.45;
}

.water-kpi-card strong {
  display: block;
  margin: 7px 0 3px;
  color: var(--cyan);
  font-size: 23px;
  line-height: 1.2;
  font-family:var(--font-app);
  font-variant-numeric: tabular-nums;
}

.water-kpi-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.water-chart-board {
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(232, 243, 248, 0.58), transparent 50%),
    rgba(255, 255, 255, 0.82);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 18px 36px rgba(16, 42, 67, 0.06);
}

.water-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.water-chart-card {
  border: 1px solid rgba(195, 212, 228, 0.92);
  border-radius: 14px;
  background:
    linear-gradient(180deg, #ffffff, #f7fbfe);
  padding: 14px;
  overflow: hidden;
}

.water-chart-card .chart {
  min-height: 300px;
  height: clamp(300px, 28vw, 390px);
}

.water-section-gallery {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.section-profile-card {
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  padding: 12px;
  min-width: 0;
}

.section-profile-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.section-profile-title strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.section-profile-title span {
  color: var(--weak);
  font-size: 12px;
  line-height: 1.35;
}

.section-chart {
  width: 100%;
  min-height: 260px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f7fbfe);
}

.section-chart text {
  font-family:var(--font-app);
  paint-order: stroke;
  stroke: rgba(255,255,255,0.86);
  stroke-width: 2px;
}

.section-chart .mono-text {
  font-family:var(--font-app);
  font-variant-numeric: tabular-nums;
}

.engineering-table-wrap {
  border-radius: 12px;
  box-shadow: 0 10px 22px rgba(16, 42, 67, 0.04);
}

.engineering-table {
  min-width: 860px;
}

.engineering-table th {
  background: linear-gradient(180deg, #eaf4f8, #dcebf4);
}

.engineering-table td {
  height: 34px;
}

.engineering-table .mono {
  color: #123b5d;
}

.source {
  margin-top: 12px;
  color: var(--weak);
  font-size: var(--fs-meta);
  line-height: 1.6;
}

.form-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 32% 22%, rgba(147, 197, 216, 0.26), transparent 28%),
    rgba(16, 42, 67, 0.22);
  backdrop-filter: blur(8px);
}

.form-dialog-card {
  width: min(620px, calc(100vw - 48px));
  border: 1px solid rgba(195, 212, 228, 0.95);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 254, 0.98)),
    #fff;
  padding: 24px;
  box-shadow: 0 30px 80px rgba(16, 42, 67, 0.24);
}

.form-dialog-card::before {
  content: "";
  display: block;
  width: 64px;
  height: 4px;
  margin-bottom: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), #50a3ad);
}

.form-dialog-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.35;
}

.form-dialog-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.dialog-grid {
  display: grid;
  gap: 12px;
}

.dialog-field {
  display: grid;
  gap: 6px;
}

.dialog-field span {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.dialog-field small {
  color: var(--weak);
  font-size: 12px;
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  border-top: 1px solid rgba(16, 42, 67, 0.08);
  padding-top: 16px;
}

.dialog-actions button {
  border: 1px solid var(--cyan);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 800;
}

@media (max-width: 960px) {
  body { min-width: 0; }
  .page { width: min(100%, calc(100vw - 28px)); }
  .layout, .form-grid, .group-grid { grid-template-columns: 1fr; }
  .region-context-grid { grid-template-columns: 1fr; }
  .actions { position: static; }
  .method-ref-head, .atlas-board-head { flex-direction: column; }
  .method-steps, .kpi-grid, .water-kpi-grid, .water-chart-grid, .water-section-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .shell, .page { width: min(100%, calc(100vw - 20px)); padding-top: 14px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .hero, .panel, .card { border-radius: 14px; }
  .panel, .card { padding: 16px; }
  .hero { padding: 18px; }
  .method-steps, .kpi-grid, .water-kpi-grid, .water-chart-grid, .water-section-gallery { grid-template-columns: 1fr; }
  .water-section-gallery { grid-column: auto; }
}

.field-help {
  display: block;
  margin-top: 7px;
  color: #526d86;
  font-size: 12px;
  line-height: 1.55;
  text-wrap: pretty;
}

/* Compact engineering workspace: controls first, method references on demand. */
.contract-card summary { cursor: pointer; color: #0a5382; font-size: 14px; font-weight: 700; }
.contract-card[open] .result-toolbar { margin-top: 14px; }
.water-chart-grid > .water-section-gallery { display: contents; }
.water-chart-grid > .water-chart-card:only-child { grid-column: 1 / -1; }
.water-chart-grid .section-profile-card { background: #fff; }
.field-inactive { opacity: .58; background: #f1f4f6; }
.field-inactive::after { content: '当前模式不参与计算'; font-size: 11px; color: #5c6d7c; }
.layout > *, .card, .panel, .param-group, .field-item { min-width: 0; }
.engineering-table-wrap, .table-scroll { max-width: 100%; overflow-x: auto; }
@media (max-width: 960px) { .layout, .form-grid, .group-grid { grid-template-columns: minmax(0,1fr); } }
.hero { grid-template-columns: minmax(0,1fr) auto; gap: 6px; padding: 16px 22px; }
.hero .back { grid-column: 1; grid-row: 1; width: fit-content; padding: 5px 10px; text-decoration: none; font-size: 13px; }
.hero .program-id { grid-column: 2; grid-row: 1; margin: 0; }
.hero h1, .hero .program-desc, .hero .program-source { grid-column: 1 / -1; }
.hero h1 { margin: 7px 0 2px; font-size: 26px; }
.hero .program-desc { margin: 2px 0; font-size: 14px; line-height: 1.65; }

.calculation-formula pre {
  margin: 10px 0 0;
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid #d7e6f3;
  background: #f7fbff;
  color: #173b53;
  font: 13px/1.65 var(--font-app);
}
.hero .program-source { margin: 2px 0; font-size: 12px; line-height: 1.6; color: #577087; }
.region-context { padding: 13px 18px; }
.region-context summary, .method-reference summary, .parameter-record summary { cursor: pointer; color: #0a5382; font-size: 14px; font-weight: 700; }
.region-context summary span { margin-left: 18px; font-size: 12px; font-weight: 400; }
.region-context[open] .region-context-grid { margin-top: 12px; }
.method-reference { padding: 13px 16px; }
.method-reference[open] .method-ref-head { margin-top: 12px; }
.parameter-tools { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; align-items: end; padding: 12px; gap: 10px; }
.parameter-tools label:first-child { grid-column: 1; grid-row: 1; }
.parameter-tools label:last-of-type { grid-column: 2; grid-row: 1; }
.parameter-tools > button { grid-column: 3; grid-row: 1; height: 41px; }
.parameter-tools p { grid-column: 1 / -1; }
.parameter-record { background: #f1f7fb; padding: 13px 16px; border: 1px solid #d2e2ed; border-radius: 10px; margin-bottom: 14px; }
.param-group-header p { max-width: 100%; font-size: 12px; }
.table-scroll { max-height: 560px; }
.table-scroll thead th { position: sticky; top: 0; z-index: 1; background: #e7f1f7; }
td { overflow-wrap: anywhere; }
@media (max-width: 960px) { .parameter-tools { grid-template-columns: 1fr auto; } .parameter-tools label:last-of-type { grid-column: 1 / -1; grid-row: 2; } .parameter-tools > button { grid-column: 2; } }
@media (max-width: 600px) { .hero { grid-template-columns: 1fr; } .hero .program-id { grid-column: 1; grid-row: 2; } .parameter-tools { display: flex; } }
