:root {
  color-scheme: light dark;
  --primary: #005ea5;
  --accent: #28a197;
  --bg: #f5f7fa;
  --text: #222;
  --muted: #6b7280;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

header {
  background: linear-gradient(120deg, var(--primary), var(--accent));
  color: #fff;
  padding: 2.5rem 1rem;
  text-align: center;
}

header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 3vw + 1rem, 3rem);
}

header p {
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.05rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: grid;
  gap: 1.5rem;
}

section {
  background: #fff;
  padding: 1.75rem;
  border-radius: 14px;
  box-shadow: 0 18px 24px -22px rgba(0, 0, 0, 0.45);
}

section h2 {
  margin-top: 0;
  color: var(--primary);
  font-size: 1.4rem;
}

section h3 {
  margin-top: 1.5rem;
  color: var(--accent);
  font-size: 1.15rem;
}

.two-column {
  display: grid;
  gap: 1rem;
}

@media (min-width: 760px) {
  .two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.sr-only-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
  white-space: nowrap;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
  white-space: nowrap;
}
label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  position: relative;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  margin-left: 0.35rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  outline: none;
  vertical-align: middle;
}

.info-icon:focus-visible,
.info-icon:hover {
  box-shadow: 0 0 0 3px rgba(40, 161, 151, 0.3);
}

.info-icon::after {
  content: '?';
}

.popover-bubble {
  position: fixed;
  max-width: min(320px, calc(100vw - 2rem));
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  box-shadow: 0 18px 28px -20px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 94, 165, 0.15);
  z-index: 1000;
  font-size: 0.9rem;
}

.popover-bubble.hidden {
  display: none;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #d4d8dd;
  font-size: 1rem;
  background: #fdfdfd;
}

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

.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.checklist li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.checklist input[type="checkbox"] {
  margin-top: 0.35rem;
  width: 1.15rem;
  height: 1.15rem;
}

.download-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

button {
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.6);
}

button.secondary-button {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

button.secondary-button:hover {
  transform: none;
  box-shadow: none;
  background: rgba(0, 94, 165, 0.08);
}

button.table-action-button {
  background: transparent;
  border: none;
  color: var(--primary);
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

button.table-action-button:hover {
  text-decoration: underline;
  transform: none;
  box-shadow: none;
}

.note {
  background: rgba(0, 94, 165, 0.08);
  border-left: 4px solid var(--primary);
  padding: 1rem;
  border-radius: 0 12px 12px 0;
  color: #0b1f3a;
  margin-top: 1rem;
}

details {
  margin-top: 1rem;
  background: rgba(40, 161, 151, 0.08);
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1rem 1rem;
  border-radius: 0 12px 12px 0;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}

.calculation-block {
  margin-top: 1.5rem;
  border: 1px solid #d8e0e7;
  border-radius: 12px;
  padding: 1.25rem;
  background: linear-gradient(180deg, rgba(0, 94, 165, 0.05), rgba(255, 255, 255, 0.95));
}

.calculation-block p {
  margin-top: 0;
}

.calculation-results {
  margin-top: 1rem;
  border-radius: 10px;
  background: rgba(0, 94, 165, 0.07);
  padding: 1rem;
}

.calculation-results p {
  margin: 0.35rem 0;
}

.calculation-details table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
}

.calculation-details th,
.calculation-details td {
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0.5rem;
  text-align: left;
}

.calculation-details th.numeric,
.calculation-details td.numeric {
  text-align: right;
}

.info-links ul {
  padding-left: 1.2rem;
  margin: 0.5rem 0 0;
}

.info-links a {
  color: var(--primary);
  text-decoration: none;
}

.info-links a:hover {
  text-decoration: underline;
}

.version-info {
  margin-top: 1.5rem;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  background: rgba(0, 94, 165, 0.06);
  border: 1px solid rgba(0, 94, 165, 0.18);
}

.version-info h3 {
  margin-top: 0;
  margin-bottom: 0.35rem;
  color: var(--primary);
}

.version-info p {
  margin: 0.35rem 0 0;
}

.version-info strong {
  color: var(--primary);
}

.version-info .version-note {
  font-size: 0.9rem;
  color: var(--muted);
}

.pipe-table-wrapper {
  overflow-x: auto;
  margin-top: 1rem;
}

.pipe-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.pipe-table th,
.pipe-table td {
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0.5rem 0.65rem;
  text-align: left;
}

.purge-hose-wrapper {
  display: grid;
  gap: 0.75rem;
}

.purge-hose-wrapper h4 {
  margin: 0;
  color: var(--primary);
  font-size: 1.05rem;
}

.pipe-table td.numeric,
.pipe-table th.numeric {
  text-align: right;
}

input.numeric-readonly {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  text-align: right;
  background: #f9fafb;
  font: inherit;
  color: inherit;
}

input.numeric-readonly:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 94, 165, 0.25);
}

.pipe-breakdown-table {
  margin-top: 1rem;
}

.pipe-inputs {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (min-width: 760px) {
  .pipe-inputs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.pipe-inputs select,
.pipe-inputs input {
  background: #fff;
}

.reference-table-container {
  display: grid;
  gap: 1rem;
}

.reference-table-container details {
  border: 1px solid #e0e4ea;
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  background: #f8fafc;
}

.reference-table-container summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
  list-style: none;
}

.reference-table-container summary::-webkit-details-marker {
  display: none;
}

.reference-table-container summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.2s ease;
}

.reference-table-container details[open] summary::before {
  transform: rotate(90deg);
}

.reference-table-container .reference-table-body {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.75rem;
}

.reference-table-summary {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

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

.reference-data-table th,
.reference-data-table td {
  border: 1px solid #e0e4ea;
  padding: 0.5rem 0.75rem;
}

.reference-data-table th {
  background: #eef2f9;
  text-align: left;
  color: var(--text);
}

.reference-data-table td.numeric,
.reference-data-table th.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}
