/*
 * PediTools data tools (bulk analysis, patient growth chart): standalone pages with their own light theme
 * (owner, 2026-10-19), full width for wide tables, and a print stylesheet (US Letter, portrait).
 */
:root {
  --pt-ink: #1f2933;
  --pt-muted: #5f6b76;
  --pt-line: #d5dbe1;
  --pt-soft: #f4f6f8;
  --pt-accent: #1f5f8b;
  --pt-accent-ink: #ffffff;
  --pt-ok: #1e6b3a;
  --pt-warn-bg: #fff6e0;
  --pt-warn-line: #e3b341;
  --pt-error-bg: #fdecec;
  --pt-error-line: #d64545;
  --pt-sent-bg: #e8f1f8;
  color-scheme: light;
}

* { box-sizing: border-box; }

body.pt-tool {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--pt-ink);
  background: #ffffff;
}

.pt-tool-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--pt-line);
  background: var(--pt-soft);
}
.pt-brand { font-weight: 700; font-size: 1.15rem; color: var(--pt-ink); text-decoration: none; }
.pt-brand:hover { text-decoration: underline; }
.pt-tool-title { color: var(--pt-muted); }

.pt-tool-main { padding: 8px 16px 32px; max-width: 1600px; margin: 0 auto; }
.pt-tool-main h1 { font-size: 1.6rem; margin: 16px 0 4px; }
.pt-lead { color: var(--pt-muted); margin-top: 0; }

.pt-step { border-top: 1px solid var(--pt-line); padding: 12px 0 8px; }
.pt-step h2 { font-size: 1.2rem; margin: 4px 0 10px; display: flex; align-items: center; gap: 10px; }
.pt-step-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.7em; height: 1.7em; border-radius: 50%;
  background: var(--pt-accent); color: var(--pt-accent-ink); font-size: 0.9rem;
}

label { font-weight: 600; margin-right: 8px; }
select, textarea, input[type="text"] {
  font: inherit; color: inherit; padding: 6px 8px; border: 1px solid var(--pt-line); border-radius: 6px; background: #fff;
  max-width: 100%;
}
textarea { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9rem; margin: 8px 0; }
button {
  font: inherit; padding: 6px 14px; border: 1px solid var(--pt-accent); border-radius: 6px;
  background: #fff; color: var(--pt-accent); cursor: pointer;
}
button.pt-primary { background: var(--pt-accent); color: var(--pt-accent-ink); font-weight: 600; padding: 8px 20px; }
button:disabled { opacity: 0.5; cursor: default; }
a { color: var(--pt-accent); }

.pt-calc-title { color: var(--pt-muted); margin: 6px 0 0; }
.pt-lead p { margin: 0 0 8px; }
.pt-starters { margin: 0 0 12px; }
button.pt-link { border: 0; background: none; padding: 0; color: var(--pt-accent); text-decoration: underline; font: inherit; }
.pt-downloads { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pt-results-wrap { max-height: 75vh; overflow: auto; }
.pt-advanced { margin: 4px 0 12px; }
.pt-advanced summary { cursor: pointer; color: var(--pt-accent); }
.pt-advanced fieldset { border: 0; padding: 4px 0; margin: 0; }
.pt-advanced legend { font-weight: 600; padding: 0; }
.pt-choice input:disabled + * , .pt-choice:has(input:disabled) { color: var(--pt-muted); }
.pt-privacy { background: var(--pt-sent-bg); border-left: 4px solid var(--pt-accent); padding: 8px 12px; margin: 0 0 12px; }

.pt-drop {
  border: 2px dashed var(--pt-line); border-radius: 10px; padding: 16px; text-align: center; background: var(--pt-soft);
}
.pt-drop p { margin: 4px 0; }
.pt-drop.pt-drag { border-color: var(--pt-accent); background: var(--pt-sent-bg); }
.pt-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pt-file-label { color: var(--pt-accent); text-decoration: underline; cursor: pointer; margin: 0; }
.pt-drop:focus-within { outline: 2px solid var(--pt-accent); outline-offset: 2px; }
.pt-hint { color: var(--pt-muted); font-size: 0.9rem; }
.pt-paste { margin: 12px 0; }
.pt-paste summary, .pt-sent summary { cursor: pointer; color: var(--pt-accent); }
.pt-status { color: var(--pt-muted); }
.pt-status.pt-error { color: var(--pt-error-line); font-weight: 600; }

.pt-table-wrap { overflow-x: auto; max-width: 100%; }
table.pt-mapping, table.pt-results, table.pt-sent-table { border-collapse: collapse; font-size: 0.92rem; }
table.pt-mapping th, table.pt-mapping td,
table.pt-results th, table.pt-results td,
table.pt-sent-table th, table.pt-sent-table td {
  border: 1px solid var(--pt-line); padding: 4px 8px; text-align: left; vertical-align: top;
}
table.pt-mapping th, table.pt-results th, table.pt-sent-table th { background: var(--pt-soft); font-weight: 600; }
table.pt-results thead th { position: sticky; top: 0; z-index: 1; }
table.pt-results td.pt-num, table.pt-results th.pt-num { text-align: right; font-variant-numeric: tabular-nums; }
table.pt-results th.pt-calc, table.pt-results td.pt-calc { background: var(--pt-sent-bg); }
table.pt-results td.pt-notes { color: var(--pt-error-line); min-width: 16em; }
.pt-samples { color: var(--pt-muted); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem; }
.pt-badge { display: inline-block; font-size: 0.8rem; padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.pt-badge-sent { background: var(--pt-sent-bg); color: var(--pt-accent); }
.pt-badge-local { background: #e9f5ec; color: var(--pt-ok); }

.pt-age-source { border: 1px solid var(--pt-line); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; }
.pt-age-source legend { font-weight: 600; padding: 0 4px; }
.pt-choice { display: block; font-weight: normal; margin: 4px 0; }
.pt-age-source .pt-hint { margin: 6px 0 0; }
.pt-messages { padding-left: 1.2em; }
.pt-messages li.pt-error { color: var(--pt-error-line); }
.pt-messages li.pt-warning { color: #7a5a00; }

.pt-more { border-top: 1px solid var(--pt-line); margin-top: 24px; color: var(--pt-muted); font-size: 0.95rem; }
.pt-more h2 { font-size: 1.1rem; color: var(--pt-ink); }
.pt-more h3 { font-size: 1rem; color: var(--pt-ink); }
.pt-alert { background: var(--pt-warn-bg); border-left: 4px solid var(--pt-warn-line); padding: 8px 12px; }

.pt-tool-footer { border-top: 1px solid var(--pt-line); padding: 12px 16px; color: var(--pt-muted); font-size: 0.9rem; }

.pt-visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

@media (max-width: 640px) {
  .pt-tool-header { flex-direction: column; gap: 0; }
  .pt-tool-main h1 { font-size: 1.35rem; }
}

@media print {
  @page { size: letter portrait; margin: 0.5in; }
  body.pt-tool { font-size: 10pt; }
  .pt-tool-header, .pt-tool-footer, .pt-drop, .pt-paste, .pt-privacy, .pt-more, button, details, select { display: none !important; }
  .pt-step { border: 0; }
  .pt-table-wrap { overflow: visible; }
  table.pt-results thead th { position: static; }
  a { color: inherit; text-decoration: none; }
}
