:root {
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #d8e1ea;
  --text: #152436;
  --muted: #5d6d7e;
  --blue: #1757a6;
  --cyan: #009eb7;
  --red: #d73333;
  --green: #2d8050;
  --orange: #e88700;
  --yellow: #fff2ba;
  --yellow-border: #e4af17;
  --readonly: #f0f2f4;
  --shadow: 0 8px 24px rgba(21, 36, 54, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-height: 100%;
}

body.has-lightbox {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

img {
  display: block;
  max-width: 100%;
}

sub {
  font-size: 0.68em;
  line-height: 0;
  vertical-align: sub;
}

.app-shell {
  width: min(1580px, calc(100vw - 28px));
  margin: 14px auto 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 62px;
  height: 62px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand p {
  margin: 0 0 3px;
  color: #25384d;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.brand h1,
.block-title h2,
.panel h2,
.hero-strip h2 {
  margin: 0;
}

.brand h1 {
  font-size: 1.34rem;
  line-height: 1.2;
}

.version-label {
  display: inline-block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.test-version-text {
  color: #c51616;
  font-weight: 800;
}

.topbar-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.topbar-actions,
.control-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.topbar-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button,
.icon-button,
.text-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.button {
  padding: 9px 12px;
  font-weight: 700;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.button.secondary {
  background: var(--surface-soft);
}

.topbar-actions .button {
  min-height: 42px;
  padding: 10px 15px;
  border-radius: 7px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(21, 36, 54, 0.08);
}

.topbar-actions .button:hover {
  transform: translateY(-1px);
}

.topbar-actions .button:active {
  transform: translateY(0);
}

.topbar-actions .reset-action {
  background: #ffffff;
  border-color: #c9d5df;
  color: #26394d;
}

.topbar-actions .reset-action:hover {
  background: #f3f7fb;
  border-color: #aebdcc;
}

.topbar-actions .help-action {
  background: #f7fbff;
  border-color: #b9c9d8;
  color: #1e4d7d;
}

.topbar-actions .help-action:hover {
  background: #edf6ff;
  border-color: #8fb1d2;
}

.topbar-actions .export-action {
  padding-inline: 18px;
  background: linear-gradient(180deg, #1e68b8, var(--blue));
  border-color: #104f99;
  box-shadow: 0 7px 16px rgba(23, 87, 166, 0.24);
}

.topbar-actions .export-action:hover {
  background: linear-gradient(180deg, #2474c7, #15549f);
  box-shadow: 0 9px 20px rgba(23, 87, 166, 0.3);
}

.button.is-busy {
  opacity: 0.72;
  cursor: progress;
}

.button.small {
  padding: 6px 9px;
  font-size: 0.86rem;
}

.icon-button {
  width: 38px;
  height: 36px;
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 1.1rem;
  line-height: 1;
}

.text-button {
  margin-top: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.86rem;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.input-stack,
.main-column {
  display: grid;
  gap: 10px;
}

.input-stack {
  position: static;
}

.calc-block,
.panel,
.hero-strip,
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.calc-block {
  overflow: hidden;
}

.block-title {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#fbfdff, #eef4fa);
}

.block-title h2,
.panel h2,
.hero-strip h2 {
  font-size: 1rem;
  line-height: 1.2;
}

.field,
.readonly-field,
.paired-row,
.value-grid,
.mini-factor-grid {
  margin: 0;
}

.calc-block > .field,
.calc-block > .field-grid,
.calc-block > .value-grid,
.calc-block > .paired-row,
.calc-block > .block-divider {
  margin: 10px 12px;
}

.field {
  display: grid;
  gap: 5px;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(140px, 1.18fr) repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.area-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 6px;
}

.unit-select {
  padding-left: 6px;
  padding-right: 6px;
}

label,
.readonly-field span,
.value-line span,
.paired-row > span,
.mini-factor-grid span {
  color: #1e3044;
  font-size: 0.83rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid #c7d3df;
  border-radius: 5px;
  padding: 7px 8px;
  background: #fff;
  color: var(--text);
}

.input-yellow {
  background: linear-gradient(#fff9d8, var(--yellow));
  border-color: var(--yellow-border);
}

textarea {
  resize: vertical;
  min-height: 86px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(0, 158, 183, 0.2);
  border-color: var(--cyan);
}

[data-help-key] {
  cursor: help;
}

input[data-help-key],
select[data-help-key],
textarea[data-help-key] {
  cursor: help;
}

.help-tooltip {
  position: fixed;
  z-index: 1200;
  width: min(320px, calc(100vw - 24px));
  padding: 9px 10px;
  border: 1px solid #b7c8d8;
  border-radius: 7px;
  background: #10243a;
  color: #fff;
  box-shadow: 0 12px 30px rgba(9, 18, 30, 0.24);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
  pointer-events: none;
}

.help-tooltip[hidden] {
  display: none;
}

.value-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.value-line,
.readonly-field,
.readonly-value,
.mini-factor-grid > div {
  min-height: 36px;
  display: grid;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid #d1d8df;
  border-radius: 5px;
  background: linear-gradient(#f6f7f8, var(--readonly));
}

.value-line.wide {
  grid-column: 1 / -1;
}

.value-line strong,
.readonly-field strong,
.readonly-value,
.mini-factor-grid strong {
  color: #0d1d2f;
  font-size: 1rem;
  font-weight: 700;
}

.calc-status-block .block-title {
  background: linear-gradient(#fbfdff, #f3f7fb);
}

.calc-status {
  margin: 10px 12px 12px;
  padding: 9px 10px;
  border: 1px solid #d1d8df;
  border-left-width: 4px;
  border-radius: 7px;
  background: #f8fbfe;
}

.calc-status-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 7px;
}

.calc-status-head span {
  color: #14263a;
  font-size: 0.94rem;
  font-weight: 800;
}

.calc-status-head strong {
  color: #516275;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.calc-status ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.calc-status li {
  position: relative;
  padding-left: 14px;
  color: #26384b;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.34;
}

.calc-status li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9fb0c1;
}

.calc-status.is-ok {
  border-color: #b9dac6;
  border-left-color: var(--green);
  background: #f2fbf5;
}

.calc-status.is-warning,
.calc-status.is-incomplete {
  border-color: #ead59a;
  border-left-color: var(--orange);
  background: #fffaf0;
}

.calc-status.is-error {
  border-color: #e4b6b6;
  border-left-color: var(--red);
  background: #fff4f4;
}

.calc-status li.ok::before {
  background: var(--green);
}

.calc-status li.warning::before,
.calc-status li.incomplete::before {
  background: var(--orange);
}

.calc-status li.error::before {
  background: var(--red);
}

.paired-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(118px, 0.85fr);
  gap: 12px;
  align-items: end;
}

.paired-row.compact-row {
  align-items: center;
}

.readonly-value {
  min-height: 34px;
  text-align: right;
}

.block-divider {
  height: 1px;
  background: var(--line);
}

.mini-factor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.panel,
.hero-strip {
  padding: 13px;
}

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

.panel-head.compact {
  align-items: center;
}

.section-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-wundt {
  width: 100%;
  padding: 0;
  overflow: hidden;
}

.wundt-table {
  font-size: 1.08rem;
}

.wundt-table th,
.wundt-table td {
  padding: 9px 11px;
}

.wundt-table th {
  background: #eef4f9;
  text-align: left;
}

.wundt-table td {
  font-size: 1.32rem;
  font-weight: 800;
  text-align: right;
}

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

.kpi-card {
  padding: 11px 14px 9px;
  border-top-width: 4px;
  min-height: 128px;
  font-size: 1.2rem;
}

.kpi-card.hq100 {
  border-color: #6aa1ff;
  border-top-color: var(--blue);
  background: linear-gradient(135deg, #f4f8ff, #eaf2ff);
}

.kpi-card.hq30 {
  border-color: #61c7d8;
  border-top-color: var(--cyan);
  background: linear-gradient(135deg, #f1fcff, #e8f8fb);
}

.kpi-card.hq10 {
  border-color: #73c984;
  border-top-color: #4bb863;
  background: linear-gradient(135deg, #f3fff4, #eaf9ec);
}

.kpi-card.hq5 {
  border-color: #ecc253;
  border-top-color: var(--orange);
  background: linear-gradient(135deg, #fffaf0, #fff4cf);
}

.kpi-card span {
  color: #333d46;
  font-weight: 800;
}

.kpi-card strong {
  display: block;
  margin-top: 4px;
  color: var(--blue);
  font-size: 1.7rem;
  line-height: 1;
  text-align: center;
}

.kpi-card.hq10 strong {
  color: #08723b;
}

.kpi-card.hq5 strong {
  color: var(--orange);
}

.kpi-card em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-weight: 800;
  text-align: center;
}

.kpi-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid currentColor;
}

.kpi-range small {
  color: #1f3348;
  font-size: 1.15rem;
  line-height: 1.1;
}

.kpi-range b {
  font-size: 1rem;
}

.kpi-range small + small {
  border-left: 1px solid rgba(21, 36, 54, 0.35);
  padding-left: 8px;
}

.tables-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.82fr);
  gap: 12px;
}

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

.content-left,
.side-column {
  display: grid;
  gap: 12px;
}

.side-column {
  position: sticky;
  top: 10px;
}

.split-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  border: 1px solid var(--line);
  padding: 7px 8px;
  text-align: right;
  vertical-align: middle;
}

.data-table th {
  background: #eef4f9;
  color: #203040;
  font-weight: 800;
}

.data-table td:first-child,
.data-table th:first-child,
.compact-table th,
.gf-table th:first-child {
  text-align: left;
}

.gf-table .summary-row th,
.gf-table .summary-row td,
.hydro-table .highlight-row th,
.hydro-table .highlight-row td {
  background: #dff1e7;
  border-color: #c9e2d4;
  font-weight: 800;
}

.compact-table td {
  width: 118px;
}

.formula-info {
  align-self: stretch;
}

.formula-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
}

.formula-layout img {
  width: 111px;
  height: auto;
  justify-self: center;
}

.formula-layout dl {
  margin: 0;
  display: grid;
  gap: 5px;
}

.formula-layout div {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 8px;
}

.formula-layout dt {
  font-weight: 800;
}

.formula-layout dd {
  margin: 0;
}

.sketch-drop {
  position: relative;
  min-height: 210px;
  border: 1px dashed #9fb0c1;
  border-radius: 8px;
  background: var(--surface-soft);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.sketch-drop.is-dragging {
  border-color: var(--cyan);
  background: #eaf8fb;
}

.sketch-preview-button {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: inherit;
  padding: 0;
  border: 0;
  background: #fff;
  cursor: zoom-in;
  place-items: center;
}

.sketch-preview-button:focus-visible {
  outline: 3px solid rgba(0, 158, 183, 0.3);
  outline-offset: -3px;
}

.sketch-drop img {
  width: 100%;
  height: 100%;
  max-height: 270px;
  object-fit: contain;
  background: #fff;
}

.sketch-empty {
  max-width: 280px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

.map-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #fff;
  cursor: zoom-in;
}

.map-open:focus-visible {
  outline: 3px solid rgba(0, 158, 183, 0.3);
  outline-offset: 3px;
}

.map-panel img {
  width: 100%;
  height: 230px;
  object-fit: contain;
  background: #fff;
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 28px;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 18, 30, 0.78);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  width: min(1120px, 96vw);
  max-height: min(860px, 92vh);
  margin: 0;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.lightbox-content figcaption {
  margin: 0 44px 12px 0;
  color: var(--text);
  font-size: 1.14rem;
  font-weight: 800;
}

.lightbox-content img {
  width: 100%;
  max-height: calc(92vh - 88px);
  object-fit: contain;
  background: #fff;
}

.help-content {
  width: min(1040px, 94vw);
  max-height: min(820px, 90vh);
  overflow: auto;
}

.help-content h2 {
  margin: 0 44px 6px 0;
  font-size: 1.35rem;
}

.help-intro {
  margin: 0 44px 16px 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.help-section {
  margin: 0 0 14px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
}

.help-section h3,
.help-subtitle {
  margin: 0 0 10px;
  color: #173f6f;
  font-size: 1.04rem;
}

.help-steps {
  margin: 0;
  padding-left: 20px;
  color: #25384d;
  line-height: 1.45;
}

.help-steps li + li {
  margin-top: 6px;
}

.help-explainer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.help-explainer-grid article {
  min-height: 116px;
  padding: 10px 11px;
  border: 1px solid #dbe6ef;
  border-radius: 7px;
  background: #fff;
}

.help-explainer-grid h4 {
  margin: 0 0 6px;
  font-size: 0.98rem;
}

.help-explainer-grid p {
  margin: 0;
  color: #2b3d50;
  line-height: 1.4;
}

.help-table-guide {
  display: grid;
  gap: 7px;
}

.help-table-guide div {
  display: grid;
  grid-template-columns: minmax(180px, 0.38fr) 1fr;
  gap: 12px;
  align-items: start;
  padding: 8px 10px;
  border: 1px solid #dbe6ef;
  border-radius: 6px;
  background: #fff;
}

.help-table-guide strong {
  color: #16283b;
}

.help-table-guide span {
  color: #2b3d50;
  line-height: 1.4;
}

.help-subtitle {
  margin-top: 16px;
}

.help-glossary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.help-glossary article {
  min-height: 118px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fbfe;
}

.help-glossary h3 {
  margin: 0 0 6px;
  color: #173f6f;
  font-size: 1rem;
}

.help-glossary p {
  margin: 0;
  color: #2b3d50;
  line-height: 1.42;
}

.lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
}

.notes-print p {
  margin: 0;
  white-space: pre-wrap;
  color: #263645;
  line-height: 1.42;
}

.notice-line {
  padding: 8px 11px;
  border: 1px solid #e6cf8f;
  border-left: 4px solid var(--orange);
  border-radius: 6px;
  background: #fffaf0;
  color: #3d3420;
  line-height: 1.35;
}

.notice-line strong {
  color: #1f3044;
}

.data-table.hydro-table {
  font-size: 1rem;
}

.hydro-table th,
.hydro-table td {
  padding: 8px 10px;
}

.hydro-table th:first-child {
  width: 34%;
}

.hydro-table .parameter-head th,
.hydro-table thead th {
  background: #e9f1f8;
  font-size: 1.02rem;
}

.hydro-table .subhead-row th {
  background: #fff;
  border-left-color: transparent;
  border-right-color: transparent;
  font-size: 1.15rem;
  text-align: left;
}

.hydro-table .subhead-row.compact th {
  font-size: 1.02rem;
  background: #f7fafc;
  border-color: var(--line);
  text-align: center;
}

.hydro-table .subhead-row.compact th:first-child {
  text-align: left;
}

.hydro-table .table-gap-row td {
  height: 10px;
  padding: 0;
  border: 0;
  background: #fff;
}

.hydro-table .formula-row th {
  height: 72px;
  font-size: 1.1rem;
  background: #fff;
  text-align: center;
}

.hydro-table .formula-row img {
  width: 111px;
  margin: 0 auto;
}

.hydro-table .ratio-row th {
  background: #f7fafc;
  font-size: 1rem;
}

.hydro-table .ratio-row td {
  background: #fff;
}

.hydro-table .em-value {
  font-weight: 800;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chart-panel {
  padding: 8px;
}

.chart-wide {
  grid-column: 1 / -1;
}

.chart {
  width: 100%;
  height: 405px;
}

.chart-wide .chart {
  height: 295px;
}

.pdf-chart-render-target {
  position: fixed;
  left: -10000px;
  top: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
}

.load-error {
  margin: 28px auto;
  max-width: 720px;
  padding: 18px;
  background: #fff1f1;
  border: 1px solid #f0b7b7;
  color: #8a1f1f;
  border-radius: 8px;
}

.pdf-export-source {
  position: fixed;
  top: 0;
  left: -1200px;
  z-index: -1;
  width: 794px;
  background: #fff;
  color: #132235;
}

.pdf-page {
  width: 794px;
  min-height: 1123px;
  padding: 26px 28px;
  background: #fff;
  color: #132235;
  font-size: 10.5px;
  line-height: 1.26;
}

.pdf-page * {
  box-shadow: none !important;
}

.pdf-report-header {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 12px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 2px solid #1f66a8;
  margin-bottom: 10px;
}

.pdf-report-header img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.pdf-report-header p {
  margin: 0 0 2px;
  font-size: 9.5px;
  font-weight: 700;
}

.pdf-report-header h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.12;
}

.pdf-report-header .version-label {
  font-size: 10px;
}

.pdf-created-at {
  align-self: end;
  color: #6b7886;
  font-size: 8.4px;
  font-weight: 700;
  white-space: nowrap;
}

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

.pdf-report-title h2 {
  margin: 0;
  font-size: 15px;
}

.pdf-report-title span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.pdf-section {
  break-inside: avoid;
  margin-bottom: 8px;
  border: 1px solid #cad7e3;
  border-radius: 6px;
  overflow: hidden;
}

.pdf-section h3 {
  margin: 0;
  padding: 6px 8px;
  background: #eef4f9;
  border-bottom: 1px solid #cad7e3;
  font-size: 11px;
}

.pdf-section-body {
  padding: 7px 8px;
}

.pdf-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pdf-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.pdf-fact {
  min-height: 36px;
  padding: 5px 6px;
  border: 1px solid #d6e0e9;
  border-radius: 4px;
  background: #f8fafc;
}

.pdf-fact span {
  display: block;
  color: #405466;
  font-size: 8.5px;
  font-weight: 800;
}

.pdf-fact strong {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.pdf-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 8px;
}

.pdf-kpi {
  padding: 7px;
  border: 1px solid #bad0e4;
  border-top: 4px solid #1f66a8;
  border-radius: 6px;
  background: #f4f8ff;
  text-align: center;
}

.pdf-kpi:nth-child(2) {
  border-top-color: var(--cyan);
  background: #effbfe;
}

.pdf-kpi:nth-child(3) {
  border-top-color: #4bb863;
  background: #f2fbf3;
}

.pdf-kpi:nth-child(4) {
  border-top-color: var(--orange);
  background: #fff8df;
}

.pdf-kpi span {
  display: block;
  text-align: left;
  font-weight: 800;
}

.pdf-kpi strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  color: #33465a;
}

.pdf-kpi em {
  display: block;
  margin-bottom: 5px;
  font-style: normal;
  font-weight: 800;
}

.pdf-kpi small {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #8ca0b2;
  padding-top: 4px;
  font-size: 9px;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9.5px;
}

.pdf-table th,
.pdf-table td {
  border: 1px solid #e9eff5;
  padding: 4px 5px;
  text-align: right;
  vertical-align: middle;
}

.pdf-table th {
  background: #eef4f9;
  font-weight: 700;
}

.pdf-table th:first-child,
.pdf-table td:first-child {
  text-align: left;
}

.pdf-table .em-row th,
.pdf-table .em-row td,
.pdf-table .pdf-key-row th,
.pdf-table .pdf-key-row td {
  background: #dff1e7;
  font-weight: 800;
}

.pdf-image-frame {
  min-height: 104px;
  display: grid;
  place-items: center;
  border: 1px solid #d6e0e9;
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}

.pdf-image-frame img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
}

.pdf-sketch-placeholder {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.pdf-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pdf-chart {
  min-height: 180px;
  border: 1px solid #d6e0e9;
  border-radius: 5px;
  background: #fff;
  padding: 4px;
}

.pdf-chart img {
  width: 100%;
  height: 180px;
  object-fit: contain;
}

.pdf-chart-wide {
  grid-column: 1 / -1;
}

.pdf-chart-wide img {
  height: 150px;
}

.pdf-note {
  padding: 7px 9px;
  border: 1px solid #e6cf8f;
  border-left: 4px solid var(--orange);
  border-radius: 5px;
  background: #fffaf0;
}

.pdf-footer {
  margin-top: 8px;
  color: var(--muted);
  font-size: 8.5px;
  text-align: right;
}

.pdf-excel-page {
  height: 1094px;
  min-height: 1094px;
  overflow: hidden;
  padding: 16px 20px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 8.1px;
  line-height: 1.16;
  color: #010101;
}

.pdf-excel-page .pdf-report-header {
  grid-template-columns: 42px 1fr auto;
  gap: 9px;
  height: 54px;
  margin-bottom: 5px;
  padding-bottom: 5px;
}

.pdf-excel-page .pdf-report-header img {
  width: 40px;
  height: 40px;
}

.pdf-excel-page .pdf-report-header p {
  font-size: 8.6px;
}

.pdf-excel-page .pdf-report-header h1 {
  font-size: 15px;
}

.pdf-excel-page .version-label {
  font-size: 8.5px;
}

.pdf-excel-page .pdf-created-at {
  font-size: 7.2px;
}

.pdf-title-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  height: 22px;
  margin-bottom: 5px;
}

.pdf-title-row span {
  color: #405466;
  font-weight: 800;
  margin-right: 5px;
}

.pdf-title-row strong {
  font-size: 12px;
}

.pdf-sheet-grid {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  gap: 7px;
}

.pdf-left-stack,
.pdf-right-stack {
  display: grid;
  align-content: start;
  gap: 5px;
}

.pdf-box {
  border: 0.45px solid #d6e0ea;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  break-inside: avoid;
}

.pdf-box h3 {
  margin: 0;
  padding: 3.2px 6px;
  border-bottom: 0.35px solid #e2e9f0;
  background: #eef3f7;
  font-size: 8.9px;
  font-weight: 700;
  line-height: 1.15;
}

.pdf-excel-page .pdf-table {
  font-size: 8.15px;
  line-height: 1.16;
}

.pdf-excel-page .pdf-table th,
.pdf-excel-page .pdf-table td {
  border-color: #f1f5f8;
  border-width: 1px;
  padding: 2.35px 3.2px;
}

.pdf-excel-page .pdf-table thead th,
.pdf-hydro-table tbody tr:first-child th,
.pdf-subhead th {
  font-size: 8.75px;
  font-weight: 800;
}

.pdf-compact-table th {
  width: 44%;
}

.pdf-ratio-factors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  align-items: stretch;
  padding: 0;
  white-space: nowrap;
}

.pdf-ratio-factors span {
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  align-content: center;
  gap: 1px;
  min-width: 0;
  padding: 1px 2px;
  line-height: 1.05;
}

.pdf-ratio-factors span + span {
  border-left: 1px solid #eaeaea;
}

.pdf-ratio-factors b,
.pdf-ratio-factors em {
  display: block;
  font-style: normal;
}

.pdf-ratio-factors b {
  font-size: 7px;
  font-weight: 800;
}

.pdf-ratio-factors em {
  font-size: 7.7px;
}

.pdf-limit {
  margin: 4px 5px 5px;
  padding: 3px 4px;
  border-left: 3px solid var(--orange);
  background: #fffaf0;
  font-weight: 800;
}

.pdf-sketch-box .pdf-image-frame {
  height: 170px;
  min-height: 170px;
  border: 0;
  border-radius: 0;
  background: #fff;
}

.pdf-sketch-box .pdf-image-frame img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 168px;
  display: block;
}

.pdf-hydro-table {
  font-size: 8.45px;
}

.pdf-hydro-table th,
.pdf-hydro-table td {
  padding-top: 2.55px;
  padding-bottom: 2.55px;
}

.pdf-section-gap td {
  height: 6px;
  padding: 0;
  border-left-color: transparent;
  border-right-color: transparent;
  background: #fff;
}

.pdf-subhead th,
.pdf-subhead td {
  background: #edf6fb;
  font-weight: 800;
}

.pdf-wundt-box .pdf-table th,
.pdf-wundt-box .pdf-table td {
  padding-top: 2.7px;
  padding-bottom: 2.7px;
}

.pdf-wundt-box .pdf-table td {
  font-size: 8.4px;
  font-weight: 800;
}

.pdf-result-chart-grid {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.95fr);
  align-items: stretch;
  gap: 5px;
}

.pdf-result-tables {
  display: grid;
  align-content: start;
  gap: 5px;
}

.pdf-gf-chart-box {
  height: 238px;
}

.pdf-ratio-chart-box {
  min-height: 206px;
}

.pdf-chart-mini {
  height: 216px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 2px 3px;
}

.pdf-chart-mini img {
  width: 100%;
  height: 216px;
  object-fit: contain;
}

.pdf-ratio-chart-box .pdf-chart-mini {
  height: 188px;
}

.pdf-ratio-chart-box .pdf-chart-mini img {
  height: 188px;
}

.pdf-bottom-visuals {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 7px;
  margin-top: 6px;
}

.pdf-hqn-chart-box,
.pdf-map-box {
  height: 248px;
}

.pdf-chart-bottom,
.pdf-map-frame {
  height: 226px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 3px;
}

.pdf-chart-bottom img {
  width: 100%;
  height: 226px;
  object-fit: contain;
}

.pdf-map-frame img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 224px;
  display: block;
}

.pdf-bottom-row {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 7px;
  margin-top: 6px;
}

.pdf-bottom-row-single {
  grid-template-columns: 1fr;
}

.pdf-excel-page .pdf-note,
.pdf-notes {
  padding: 5px 7px;
  border-radius: 4px;
  font-size: 8px;
}

.pdf-notes {
  border: 1px solid #d6e0e9;
  background: #f8fafc;
}

.pdf-export-source.is-debug {
  position: static;
  z-index: auto;
  left: auto;
  width: 794px;
  margin: 20px auto;
  border: 1px solid #9aa8b7;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

@media (max-width: 1220px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .input-stack {
    position: static;
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 18px, 1580px);
    margin-top: 9px;
  }

  .topbar,
  .brand,
  .hero-strip,
  .tables-row,
  .split-row,
  .charts-grid,
  .content-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .side-column {
    position: static;
  }

  .topbar-side {
    justify-items: start;
  }

  .kpi-grid,
  .value-grid {
    grid-template-columns: 1fr 1fr;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .paired-row {
    grid-template-columns: 1fr;
  }

  .help-glossary {
    grid-template-columns: 1fr;
  }

  .help-explainer-grid {
    grid-template-columns: 1fr;
  }

  .help-table-guide div {
    grid-template-columns: 1fr;
  }

  .help-content {
    padding: 15px;
  }

}

@media print {
  @page {
    size: A4 landscape;
    margin: 7mm;
  }

  html,
  body {
    background: #fff;
    font-size: 9.6px;
  }

  .app-shell {
    width: 100%;
    margin: 0;
  }

  .topbar-actions,
  .text-button,
  .lightbox {
    display: none !important;
  }

  .topbar,
  .calc-block,
  .panel,
  .hero-strip,
  .kpi-card {
    box-shadow: none;
    border-color: #9aa8b7;
  }

  .topbar {
    padding: 5px 7px;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }

  .brand p {
    font-size: 0.8rem;
  }

  .brand h1 {
    font-size: 1rem;
  }

  .workspace {
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 6px;
    margin-top: 6px;
  }

  .input-stack,
  .main-column {
    gap: 5px;
    position: static;
  }

  .calc-block > .field,
  .calc-block > .field-grid,
  .calc-block > .value-grid,
  .calc-block > .paired-row,
  .calc-block > .block-divider {
    margin: 5px 7px;
  }

  .block-title {
    padding: 5px 7px;
  }

  .block-title h2,
  .panel h2,
  .hero-strip h2 {
    font-size: 0.9rem;
  }

  input,
  select,
  textarea {
    min-height: 26px;
    padding: 3px 5px;
  }

  textarea {
    min-height: 46px;
  }

  .panel,
  .hero-strip {
    padding: 6px;
  }

  .hero-strip {
    display: block;
  }

  .kpi-grid {
    gap: 5px;
  }

  .kpi-card {
    min-height: 82px;
    padding: 6px 8px;
  }

  .kpi-card strong {
    font-size: 1.35rem;
  }

  .kpi-range small {
    font-size: 0.78rem;
  }

  .kpi-range b {
    font-size: 0.84rem;
  }

  .tables-row,
  .split-row,
  .charts-grid {
    gap: 5px;
  }

  .data-table th,
  .data-table td {
    padding: 3px 4px;
  }

  .hydro-table .formula-row img {
    width: 96px;
  }

  .sketch-drop {
    min-height: 120px;
  }

  .sketch-drop img {
    max-height: 135px;
  }

  .map-panel img {
    height: 128px;
  }

  .chart {
    height: 165px;
  }

  .chart-wide .chart {
    height: 135px;
  }
}
