/* =========================================================
   Nuclear Medicine Radionuclide Planner — Shared Styles
   ========================================================= */

:root {
  --green-900: #1b4332;
  --green-800: #1e5631;
  --green-700: #2d6a4f;
  --green-600: #40916c;
  --green-400: #74c69d;
  --green-100: #d8f3dc;
  --green-50:  #f0faf2;

  --gray-900: #212529;
  --gray-800: #343a40;
  --gray-700: #495057;
  --gray-500: #adb5bd;
  --gray-200: #e9ecef;
  --gray-100: #f8f9fa;
  --white:    #ffffff;

  --accent:   #0077b6;
  --warning:  #e76f00;
  --danger:   #b00020;
  --info:     #0096c7;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.10);
  --shadow:    0 2px 8px rgba(0,0,0,.12);
  --radius:    6px;
  --radius-lg: 10px;

  --font-mono: 'Consolas', 'Menlo', 'Liberation Mono', monospace;
  --font-sans: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

/* ---- Dark mode variant ---- */
[data-theme="dark"] {
  --green-900: #74c69d;
  --green-800: #95d5b2;
  --green-700: #52b788;
  --green-600: #74c69d;
  --green-400: #40916c;
  --green-100: #1a3a2a;
  --green-50:  #112318;

  --gray-900: #f0f0f0;
  --gray-800: #d0d0d0;
  --gray-700: #a0a0a0;
  --gray-500: #6c757d;
  --gray-200: #2c2f33;
  --gray-100: #1a1d21;
  --white:    #23272b;

  --accent:  #48cae4;
  --warning: #f4a261;
  --danger:  #e63946;
  --info:    #48cae4;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow:    0 2px 8px rgba(0,0,0,.5);
}

[data-theme="dark"] .site-header,
[data-theme="dark"] .site-footer,
[data-theme="dark"] .data-table th {
  background: #1a2e25;
  color: #ffffff;
}

[data-theme="dark"] body { background: #0f1517; }

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--gray-100);
  color: var(--gray-900);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header / Nav ---- */
.site-header {
  background: var(--green-900);
  color: var(--white);
  padding: 0 1.5rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 58px;
}

.site-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
  letter-spacing: .02em;
}

.site-logo span { color: var(--green-400); }

.site-nav {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: rgba(255,255,255,.80);
  padding: .35rem .85rem;
  border-radius: var(--radius);
  font-size: .9rem;
  transition: background .15s, color .15s;
}

.site-nav a:hover,
.site-nav a.active {
  background: var(--green-700);
  color: var(--white);
  text-decoration: none;
}

/* ---- Main Content ---- */
.page-body {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  width: 100%;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green-900);
  margin-bottom: .3rem;
}

.page-subtitle {
  font-size: .9rem;
  color: var(--gray-700);
  margin-bottom: 1.5rem;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 1rem; }

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--green-800);
  margin-bottom: .9rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--green-100);
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ---- Tables ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.data-table th {
  background: var(--green-900);
  color: var(--white);
  padding: .55rem .75rem;
  text-align: left;
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .02em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th:first-child { border-radius: var(--radius) 0 0 0; }
.data-table th:last-child  { border-radius: 0 var(--radius) 0 0; }

.data-table td {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) td { background: var(--green-50); }
.data-table tbody tr:hover td { background: var(--green-100); cursor: pointer; }
.data-table tbody tr.selected td { background: #c8ebd4; }

.data-table .num { text-align: right; font-family: var(--font-mono); font-size: .83rem; }
.data-table .sym { font-weight: 700; font-size: .95rem; color: var(--green-900); }
.data-table .tag { font-size: .72rem; padding: .15rem .4rem; border-radius: 3px; font-weight: 600; white-space: nowrap; }

.tag-pet       { background: #dbeafe; color: #1d4ed8; }
.tag-spect     { background: #fef9c3; color: #854d0e; }
.tag-therapy   { background: #fee2e2; color: #991b1b; }
.tag-brachy    { background: #ede9fe; color: #4c1d95; }
.tag-other     { background: var(--gray-200); color: var(--gray-700); }
.tag-custom    { background: #fef08a; color: #713f12; }

/* ---- Forms ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .9rem 1.2rem;
}

.form-group { display: flex; flex-direction: column; gap: .3rem; }

.form-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-700);
}

.form-label sup { font-size: .7em; }

.form-input, .form-select {
  padding: .45rem .65rem;
  border: 1px solid var(--gray-500);
  border-radius: var(--radius);
  font-size: .9rem;
  background: var(--white);
  color: var(--gray-900);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}

[data-theme="dark"] .form-label {
  color: var(--gray-800);
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select {
  background: var(--gray-200);
  color: var(--gray-900);
  border-color: var(--gray-700);
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(64,145,108,.18);
}

.form-hint {
  font-size: .75rem;
  color: var(--gray-700);
  margin-top: .1rem;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border: none;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .1s;
}

.btn:active { transform: translateY(1px); }

.btn-primary  { background: var(--green-700); color: var(--white); }
.btn-primary:hover  { background: var(--green-800); }
.btn-secondary{ background: var(--gray-200); color: var(--gray-900); }
.btn-secondary:hover{ background: var(--gray-500); color: var(--white); }
.btn-danger   { background: var(--danger); color: var(--white); }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }

[data-theme="dark"] .btn-secondary {
  background: var(--gray-800);
  color: var(--gray-100);
  border: 1px solid var(--gray-700);
}

[data-theme="dark"] .btn-secondary:hover {
  background: var(--gray-700);
  color: var(--white);
}

/* ---- Result boxes ---- */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}

.result-box {
  background: var(--green-50);
  border: 1px solid var(--green-400);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  text-align: center;
}

.result-box.warning { background: #fff7ed; border-color: var(--warning); }
.result-box.danger  { background: #fff0f0; border-color: var(--danger); }

.result-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: .2rem;
}

.result-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green-900);
  font-family: var(--font-mono);
  line-height: 1.2;
}

.result-unit {
  font-size: .78rem;
  color: var(--gray-700);
  margin-top: .1rem;
}

[data-theme="dark"] .result-box {
  background: var(--green-100);
  border-color: var(--green-400);
}

[data-theme="dark"] .result-box.warning {
  background: #3a2a1a;
  border-color: var(--warning);
}

[data-theme="dark"] .result-box.danger {
  background: #3a1a1a;
  border-color: var(--danger);
}

[data-theme="dark"] .result-label {
  color: var(--gray-800);
}

[data-theme="dark"] .result-value {
  color: var(--green-800);
}

[data-theme="dark"] .result-unit {
  color: var(--gray-800);
}

/* ---- Nuclide detail panel ---- */
.nuclide-detail {
  display: none;
  border-top: 3px solid var(--green-600);
  margin-top: 1rem;
  padding-top: 1rem;
}

.nuclide-detail.visible { display: block; }

.nuclide-header {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.nuclide-symbol-large {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--green-900);
  line-height: 1;
}

.nuclide-meta { flex: 1; min-width: 200px; }
.nuclide-name { font-size: 1.1rem; font-weight: 700; color: var(--green-800); }
.nuclide-use  { font-size: .85rem; color: var(--gray-700); margin-top: .3rem; line-height: 1.4; }

.prop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .5rem;
}

.prop-item {
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: .55rem .75rem;
}

.prop-key {
  font-size: .72rem;
  font-weight: 700;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.prop-val {
  font-size: .98rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--gray-900);
  margin-top: .1rem;
}

.prop-note { font-size: .72rem; color: var(--gray-700); margin-top: .1rem; font-style: italic; }

[data-theme="dark"] .prop-item {
  background: var(--gray-200);
}

[data-theme="dark"] .prop-key {
  color: var(--gray-700);
}

[data-theme="dark"] .prop-val {
  color: var(--gray-900);
}

[data-theme="dark"] .prop-note {
  color: var(--gray-700);
}

/* ---- Search bar ---- */
.search-bar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}

.search-input {
  flex: 1;
  min-width: 220px;
  padding: .5rem .9rem;
  border: 1px solid var(--gray-500);
  border-radius: var(--radius);
  font-size: .9rem;
  background: var(--white);
  color: var(--gray-900);
}

.search-input:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(64,145,108,.18);
}

[data-theme="dark"] .search-input {
  background: var(--gray-200);
  color: var(--gray-900);
  border-color: var(--gray-700);
}

.filter-bar {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}

.filter-btn {
  padding: .28rem .7rem;
  border-radius: 20px;
  border: 1px solid var(--gray-500);
  background: var(--white);
  color: var(--gray-900);
  font-size: .8rem;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}

.filter-btn.active {
  background: var(--green-700);
  color: var(--white);
  border-color: var(--green-700);
}

[data-theme="dark"] .filter-btn {
  background: var(--gray-800);
  color: var(--gray-100);
  border-color: var(--gray-700);
}

[data-theme="dark"] .filter-btn.active {
  background: var(--green-700);
  color: var(--white);
  border-color: var(--green-700);
}

/* ---- Chart container ---- */
.chart-wrap {
  position: relative;
  height: 300px;
  margin-top: .75rem;
}

/* ---- Alerts ---- */
.alert {
  padding: .65rem 1rem;
  border-radius: var(--radius);
  font-size: .85rem;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: break-word;
  margin-bottom: .75rem;
  color: var(--gray-900);
}

.alert-info    { background: #e0f2fe; border-left: 4px solid var(--info); }
.alert-warning { background: #fff7ed; border-left: 4px solid var(--warning); }
.alert-danger  { background: #fff0f0; border-left: 4px solid var(--danger); }
.alert-success { background: var(--green-100); border-left: 4px solid var(--green-600); }

[data-theme="dark"] .alert {
  color: var(--gray-100);
}

[data-theme="dark"] .alert-info {
  background: #1a3a4a;
  border-left-color: var(--info);
}

[data-theme="dark"] .alert-warning {
  background: #3a2a1a;
  border-left-color: var(--warning);
}

[data-theme="dark"] .alert-danger {
  background: #3a1a1a;
  border-left-color: var(--danger);
}

[data-theme="dark"] .alert-success {
  background: #1a3a2a;
  border-left-color: var(--green-600);
}

/* ---- Footer ---- */
.site-footer {
  background: var(--green-900);
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: .75rem 1rem;
  font-size: .78rem;
}

.site-footer a { color: var(--green-400); }

/* ---- Upload zone ---- */
.drop-zone {
  border: 2px dashed var(--gray-500);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--gray-100);
  color: var(--gray-700);
}

.drop-zone.drag-over {
  border-color: var(--green-600);
  background: var(--green-50);
}

.drop-zone-icon { font-size: 2rem; color: var(--gray-500); margin-bottom: .5rem; }
.drop-zone-text { font-size: .9rem; color: var(--gray-700); }
.drop-zone-hint { font-size: .78rem; color: var(--gray-500); margin-top: .3rem; }

[data-theme="dark"] .drop-zone {
  background: var(--gray-200);
  border-color: var(--gray-700);
  color: var(--gray-800);
}

[data-theme="dark"] .drop-zone.drag-over {
  border-color: var(--green-600);
  background: var(--green-100);
}

[data-theme="dark"] .drop-zone-icon {
  color: var(--gray-700);
}

[data-theme="dark"] .drop-zone-text {
  color: var(--gray-800);
}

[data-theme="dark"] .drop-zone-hint {
  color: var(--gray-700);
}

/* ---- Dose limit reference lines ---- */
.limit-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  padding: .2rem .5rem;
  border-radius: 4px;
  font-weight: 600;
}

.limit-public     { background: #dbeafe; color: #1e40af; }
.limit-worker     { background: #fef9c3; color: #713f12; }
.limit-extremity  { background: #fce7f3; color: #9d174d; }

[data-theme="dark"] .limit-badge {
  color: var(--gray-100);
}

[data-theme="dark"] .limit-public {
  background: #1a3a4a;
  color: #48cae4;
}

[data-theme="dark"] .limit-worker {
  background: #3a3a1a;
  color: #f4a261;
}

[data-theme="dark"] .limit-extremity {
  background: #3a1a2a;
  color: #e76f8f;
}

/* ---- Misc utilities ---- */
.mono { font-family: var(--font-mono); }
.text-sm { font-size: .82rem; }
.text-muted { color: var(--gray-700); }
.text-right { text-align: right; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 1rem 0; }

/* ---- Custom page styles ---- */
.methodology-text {
  margin: .75rem 0 .5rem;
  font-size: 1.08em;
  letter-spacing: .01em;
  font-family: Georgia, serif;
  line-height: 2;
}

.methodology-table {
  border-collapse: collapse;
  margin-top: .25rem;
  line-height: 1.8;
}

.methodology-td {
  padding-right: 1rem;
  white-space: nowrap;
  font-family: Georgia, serif;
}

.emissions-table-wrap {
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
}

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

.file-input-hidden {
  display: none;
}

.form-select-narrow {
  width: 90px;
}

.form-select-medium {
  width: 80px;
}

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

.max-height-260 {
  max-height: 260px;
  overflow-y: auto;
}

.justify-between {
  justify-content: space-between;
}

.percent-symbol {
  line-height: 2.2rem;
  padding: 0 0.4rem;
}

.ref-list {
  line-height: 1.7;
  padding-left: 1.2rem;
}

.loading-cell {
  padding: 1rem;
}

.emission-row-dim {
  opacity: 0.55;
}

.meets-yes {
  color: var(--green-700);
  font-weight: 700;
}

.meets-no {
  color: var(--gray-500);
}

/* ---- Sticky table wrapper ---- */
.table-scroll-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 420px;
}

/* ---- Custom tooltips ---- */
.has-tooltip {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted var(--gray-500);
}

.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: #fff;
  font-size: .72rem;
  font-family: var(--font-sans);
  font-weight: 400;
  padding: .35rem .6rem;
  border-radius: 4px;
  white-space: normal;
  max-width: 240px;
  min-width: 140px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, visibility .15s;
  z-index: 200;
  line-height: 1.4;
}

.has-tooltip::before {
  content: '';
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: var(--gray-800);
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, visibility .15s;
  z-index: 200;
}

.has-tooltip:hover::after,
.has-tooltip:focus::after,
.has-tooltip:hover::before,
.has-tooltip:focus::before {
  opacity: 1;
  visibility: visible;
}

[data-theme="dark"] .has-tooltip::after {
  background: var(--gray-700);
}

[data-theme="dark"] .has-tooltip::before {
  border-bottom-color: var(--gray-700);
}

/* Tooltip variant that opens upward (for overflow containers) */
.has-tooltip.tooltip-up::after {
  top: auto;
  bottom: calc(100% + 8px);
}

.has-tooltip.tooltip-up::before {
  top: auto;
  bottom: calc(100% + 2px);
  border-bottom-color: transparent;
  border-top-color: var(--gray-800);
}

/* ---- Dark mode: tag badges ---- */
[data-theme="dark"] .tag-pet     { background: #1a3a4a; color: #48cae4; }
[data-theme="dark"] .tag-spect   { background: #3a3a1a; color: #f4a261; }
[data-theme="dark"] .tag-therapy { background: #3a1a1a; color: #e76f8f; }
[data-theme="dark"] .tag-brachy  { background: #3a1a3a; color: #d6a7f0; }
[data-theme="dark"] .tag-custom  { background: #3a3a2a; color: #ffd700; }

/* ---- Dark mode: selected table row ---- */
[data-theme="dark"] .data-table tbody tr.selected td { background: var(--green-100); }

/* ---- Dark mode: methodology box styling ---- */
[data-theme="dark"] .methodology-text {
  color: var(--gray-100);
}

[data-theme="dark"] .methodology-table {
  color: var(--gray-100);
}

[data-theme="dark"] .methodology-td {
  color: var(--gray-100);
}

/* ---- Dark mode toggle button ---- */
.btn-icon {
  background: none;
  border: 1px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.85);
  border-radius: var(--radius);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  margin-left: auto;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
}

.btn-icon:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.6);
}

/* ---- Keyboard shortcuts ---- */
kbd {
  background: var(--gray-200);
  color: var(--gray-800);
  border: 1px solid var(--gray-500);
  border-radius: 3px;
  padding: .1rem .35rem;
  font-family: var(--font-mono);
  font-size: .75rem;
}

.keyboard-hint {
  text-align: right;
  margin-top: 1.5rem;
  opacity: .6;
  font-size: .82rem;
}

/* ---- Calculation history ---- */
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.history-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .45rem .75rem;
  border-bottom: 1px solid var(--gray-200);
  font-size: .82rem;
  cursor: pointer;
  transition: background .1s;
}

.history-item:hover {
  background: var(--green-50);
}

.history-ts {
  color: var(--gray-700);
  font-size: .72rem;
  white-space: nowrap;
}

.history-summary {
  flex: 1;
}

.history-restore {
  color: var(--accent);
  font-size: .75rem;
  white-space: nowrap;
}

/* ---- Accessibility: Skip link ---- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--green-900);
  color: white;
  padding: .5rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 999;
  transition: top .1s;
}

.skip-link:focus {
  top: 0;
}

/* ---- Print styles ---- */
@media print {
  /* Hide interactive chrome */
  .site-header, .site-footer,
  .btn, .filter-bar, .search-bar,
  .drop-zone, #clearSearch,
  [data-no-print] {
    display: none !important;
  }

  /* Reset layout for print */
  body {
    background: white;
    color: black;
    font-size: 10pt;
  }

  .page-body {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  /* Cards become plain sections */
  .card {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 1rem;
    padding: 1rem;
  }

  /* Table: full width, no hover effects, visible borders */
  .data-table {
    font-size: 8pt;
  }

  .data-table th {
    background: #2d6a4f;
    color: white;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .data-table tbody tr:nth-child(even) td {
    background: #f0faf2;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .data-table tbody tr:hover td {
    background: inherit;
  }

  /* Charts: preserve on print */
  .chart-wrap {
    height: 220pt;
  }

  /* Result boxes: flow as 2-column grid */
  .result-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Page header stamp */
  .page-body::before {
    content: "NM Radionuclide Planner — " attr(data-print-title) " — Generated " attr(data-print-date);
    display: block;
    font-size: 8pt;
    color: #555;
    margin-bottom: 1rem;
    border-bottom: 1px solid #ccc;
    padding-bottom: 4pt;
  }

  /* Force page breaks between major sections */
  .card + .card {
    page-break-before: auto;
  }

  #detailPanel {
    page-break-before: always;
  }

  /* Nuclide detail: visible always when printing */
  .nuclide-detail {
    display: block !important;
  }

  /* Suppress URL printing */
  a[href]::after {
    content: none;
  }

  /* Sticky headers don't need to be sticky in print */
  .data-table th {
    position: static;
  }
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .page-body {
    padding: 1.25rem 1.25rem 2rem;
  }

  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .prop-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .result-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .site-header .inner {
    height: auto;
    padding: .6rem 0;
    flex-wrap: wrap;
  }

  .site-nav {
    gap: .15rem;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .site-nav a {
    white-space: nowrap;
    font-size: .8rem;
    padding: .3rem .6rem;
  }

  .page-body {
    padding: 1rem;
  }

  .result-value {
    font-size: 1.1rem;
  }

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

  .data-table {
    font-size: .78rem;
  }

  .data-table th,
  .data-table td {
    padding: .4rem .5rem;
  }

  .nuclide-symbol-large {
    font-size: 1.8rem;
  }
}

@media (max-width: 420px) {
  .page-body {
    padding: .75rem .75rem 2rem;
  }

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

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