:root {
  --bg: #f2f4f3; --card: #fff; --ink: #18232e; --muted: #5b6770; --line: #dfe4e2;
  --navy: #173f5a; --navy-2: #245a7d; --green: #0f7f86; --green-dark: #0a5f66; --green-soft: #e3f3f4;
  --shadow: 0 1px 2px rgba(24,35,46,.06), 0 4px 14px rgba(24,35,46,.07); --radius: 12px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.5; overflow-wrap: break-word; }
a { color: var(--green-dark); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }
code { background: #eef1f0; padding: 1px 5px; border-radius: 5px; font-size: .9em; word-break: break-all; }

.top { background: var(--navy); color: #fff; padding: 12px 0; }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 18px; }
.brand { color: #fff; text-decoration: none; font-weight: 600; font-size: 17px; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 8px; }
.brand b { color: #8fdde2; }
.top nav { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 14px; }
.top nav a { color: #d6dee8; text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.top nav a:hover, .top nav a[aria-current] { color: #fff; border-bottom-color: #8fdde2; }

h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.1; letter-spacing: -.02em; margin: 28px 0 8px; }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 20px; max-width: 700px; }
h2 { font-size: clamp(20px, 3vw, 24px); margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 17px; margin: 0 0 6px; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.calc-panel { border-top: 4px solid var(--green); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tab { font: inherit; font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.tab[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -6px 0 16px; }
.presets span { font-size: 13px; font-weight: 600; color: var(--muted); margin-right: 2px; }
.presets .tab { font-weight: 500; padding: 5px 12px; }
.calc .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 14px; }
.calc label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 0; }
.calc label small { font-weight: 400; }
.calc label.wide { grid-column: 1 / -1; }
.calc input, .calc select, .calc textarea { font: inherit; font-size: 17px; padding: 10px 12px; border-radius: 9px; border: 1.5px solid #cfd6d3; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
.calc textarea { font-family: ui-monospace, Consolas, monospace; font-size: 15px; resize: vertical; }
.calc input:focus, .calc select:focus, .calc textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(15,127,134,.22); }
.inp { position: relative; display: flex; align-items: center; }
.inp i { position: absolute; right: 12px; font-style: normal; color: var(--muted); pointer-events: none; font-size: 14px; }
.inp i.pre { left: 12px; right: auto; }
.inp i.pre + input { padding-left: 26px; }
.share-row { margin: 10px 0 0; }
.share { font: inherit; font-size: 13px; font-weight: 600; color: var(--green-dark); background: none; border: 1.5px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.btn { font: inherit; font-weight: 700; font-size: 16px; color: #fff; background: var(--green); border: 0; border-radius: 10px; padding: 12px 20px; cursor: pointer; }
.btn:hover { background: var(--green-dark); }

.results { margin-top: 18px; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.totals div { background: #f4f6f5; border-radius: 10px; padding: 12px 14px; min-width: 0; }
.totals .main { background: var(--green-soft); outline: 2px solid var(--green); }
.totals b { display: block; font-size: clamp(22px, 4.6vw, 32px); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.totals span { font-size: 13px; color: var(--muted); }
.calcline { font-size: 15px; margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.bd, .ref { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; margin-top: 10px; }
.bd th, .bd td, .ref th, .ref td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.bd thead th, .ref thead th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.ref thead th small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.bd tbody th { font-weight: 500; }
.bd tfoot th, .bd tfoot td { font-weight: 700; border-bottom: 0; }
.bd tr.hi { background: var(--green-soft); }
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ref { min-width: 460px; }
.sheet { font-size: 13px; min-width: 560px; }
.sheet td { padding: 5px 8px; border: 1px solid var(--line); white-space: nowrap; }
.sheet td.rn { background: #f4f6f5; color: var(--muted); text-align: right; width: 1%; }
.sheet td.fx { background: #eef6f1; }
.ph { margin-top: 18px; }
.tip { margin: 12px 0 0; padding: 10px 12px; border-left: 4px solid var(--green); background: var(--green-soft); border-radius: 0 9px 9px 0; font-size: 15px; }
.note, .hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.soon { margin: 14px 0 0; padding: 10px 12px; border: 1.5px dashed #b9c6c0; border-radius: 9px; font-size: 14px; }
.aff { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 14px; background: #fbfcfb; }
.aff-label { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.aff p { margin: 6px 0; }
.ad-slot:empty { display: none; }
.ad-slot { margin: 0 0 20px; min-height: 90px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { border: 1.5px solid var(--line); border-radius: 10px; padding: 14px; }
.card p { margin: 6px 0; font-size: 15px; }
.card .ex { color: var(--muted); font-size: 14px; }
.role { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.role p { margin: 4px 0; }
.dl { padding-left: 20px; }
.dl li { margin: 6px 0; }
.dl span { display: block; font-size: 14px; color: var(--muted); }

.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 650; }
.faq p { margin: 8px 0 2px; color: #33404a; }
.links { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; }
.prose ul, .panel ul, .panel ol { padding-left: 20px; }
.panel ul.links { padding-left: 0; }
footer { font-size: 13px; color: var(--muted); padding: 10px 16px 40px; }
footer a { color: var(--muted); }
.fcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 24px; padding: 8px 0; }
.fcols b { display: block; color: var(--ink); margin: 10px 0 4px; }
.fcols .links { display: block; }
.fcols .links li { margin: 3px 0; }
@media (max-width: 560px) { .panel { padding: 16px; } .totals { grid-template-columns: 1fr 1fr; } .totals .main { grid-column: 1 / -1; } .top nav { font-size: 13px; } .calc .grid { grid-template-columns: 1fr 1fr; } }

/* 8-minute rule calculator */
.crumbs { font-size: 13px; color: var(--muted); margin: 18px 0 -14px; }
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 6px; }
.muted { color: var(--muted); }
.emr fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.emr legend { font-weight: 700; font-size: 15px; padding: 0; margin-bottom: 6px; }
.emr legend small { font-weight: 400; color: var(--muted); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; gap: 4px 10px; align-items: end; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
.row label small { font-weight: 400; }
.row input { font: inherit; font-size: 17px; padding: 9px 11px; border-radius: 9px; border: 1.5px solid #cfd6d3; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
.row input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(15,127,134,.22); }
.row .lbl { grid-column: 1 / -1; font-size: 13px; color: var(--muted); min-height: 0; }
.row .lbl:empty { display: none; }
.x { font: inherit; font-size: 22px; line-height: 1; width: 40px; height: 44px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; color: var(--muted); cursor: pointer; }
.x:hover { color: #a33; border-color: #e3b6b6; }
.add { font: inherit; font-size: 14px; font-weight: 600; margin-top: 8px; padding: 7px 14px; border-radius: 999px; border: 1.5px dashed var(--green); background: #fff; color: var(--green-dark); cursor: pointer; }
.steps { margin: 12px 0 0; padding-left: 22px; font-size: 15px; }
.steps li { margin: 4px 0; }
.warn { margin: 12px 0 0; padding: 10px 12px; border-left: 4px solid #c27c0e; background: #fdf4e3; border-radius: 0 9px 9px 0; font-size: 15px; }
.warnline { color: #9a5d00; }
.ul { padding-left: 20px; margin: 6px 0; }
.ul li { margin: 4px 0; }
.bar { height: 10px; background: #e7ecea; border-radius: 99px; overflow: hidden; margin: 4px 0 8px; }
.bar span { display: block; height: 100%; background: var(--green); }
.calc-wrap .row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.kx .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; }
.src { font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.src a { color: var(--muted); }
.chart td, .chart th { font-size: 16px; }
.printbtn { margin: 0 0 12px; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--green-soft); color: var(--green-dark); }
.badge.u { background: #eef1f6; color: #3b4f6b; }
@media (max-width: 560px) { .row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 40px; } }
@media print {
  .top, footer, .aff, .share-row, .printbtn, .crumbs, .no-print, .faq, .ad-slot { display: none !important; }
  body { background: #fff; }
  .panel { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
