/* Calculator kit (views/_calc.cjs + client/calc-kit.js). Every calculator built on the kit gets these rules and needs
 * none of its own. Classes: .vt-calc (the app), .vt-calc-* (its parts and the method section under it). Hairlines are 1px. */
#visu-tools .vt-calc .vt-in { display: grid; gap: 16px; align-content: start; }
#visu-tools .vt-calc .vt-in > [hidden], #visu-tools .vt-calc .vt-calc-f[hidden] { display: none !important; }
#visu-tools .vt-calc .vt-calc-choice { display: grid; gap: 6px; min-width: 0; }
#visu-tools .vt-calc .vt-seg-item span { min-height: 36px; padding: 6px 12px; font-size: 14px; }
#visu-tools .vt-calc .vt-fieldset { margin: 0 !important; }
#visu-tools .vt-calc .vt-fieldset > legend { margin-bottom: 6px; }
#visu-tools .vt-calc .vt-calc-group > .vt-hint { margin-bottom: 10px !important; }
#visu-tools .vt-calc-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
#visu-tools .vt-calc-grid.vt-calc-cols-1 { grid-template-columns: minmax(0, 1fr); }
#visu-tools .vt-calc-grid.vt-calc-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#visu-tools .vt-calc-grid.vt-calc-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#visu-tools .vt-calc .vt-unit[data-unit="money"]:not(:empty) + input { padding-left: 56px !important; }
#visu-tools .vt-calc .vt-unit[data-unit="suffix"]:not(:empty) { left: auto; right: 14px; }
#visu-tools .vt-calc .vt-unit[data-unit="suffix"]:not(:empty) + input { padding-left: 14px !important; padding-right: 38px !important; }
#visu-tools .vt-calc input[aria-invalid="true"] { border-color: var(--vt-err) !important; }
#visu-tools .vt-calc-fold { border-top: 1px solid var(--vt-line); padding-top: 14px; }
#visu-tools .vt-calc-fold > summary { cursor: pointer; font-size: 14.5px; font-weight: 650; color: var(--vt-ink); }
#visu-tools .vt-calc-fold[open] > summary { margin-bottom: 12px; }
#visu-tools .vt-calc-cur { display: grid; gap: 6px; border-top: 1px solid var(--vt-line); padding-top: 14px; }
#visu-tools .vt-calc-cur .vt-field { max-width: 280px; }
#visu-tools .vt-calc-tools { display: flex; flex-wrap: wrap; gap: 6px 20px; }
#visu-tools .vt-calc-tools:empty { display: none; }

#visu-tools .vt-calc .vt-big-num { font-size: clamp(30px, 3.6vw, 44px); overflow-wrap: anywhere; }
#visu-tools .vt-calc .vt-metrics > div { align-content: start; }
#visu-tools .vt-calc .vt-metrics dd { overflow-wrap: anywhere; }
#visu-tools .vt-calc .vt-calc-neg { color: var(--vt-err); }
#visu-tools .vt-calc-say { display: grid; gap: 8px; }
#visu-tools .vt-calc-say:empty { display: none; }
#visu-tools .vt-calc-say p { padding: 10px 14px; border: 1px solid var(--vt-line); border-radius: 12px; background: var(--vt-bg); font-size: 14.5px; line-height: 1.5; color: var(--vt-text); }

#visu-tools .vt-calc-wide { grid-column: 1 / -1; display: grid; gap: 14px; }
#visu-tools .vt-calc-wide[hidden] { display: none; }
#visu-tools .vt-calc-table-h { font-size: 20px !important; font-weight: 700 !important; }
#visu-tools .vt-calc .vt-table th { width: auto; white-space: normal; }
#visu-tools .vt-calc .vt-table thead th { font-size: 13px; }
#visu-tools .vt-calc .vt-table tbody th { color: var(--vt-ink); white-space: nowrap; }
#visu-tools .vt-calc .vt-table :is(td, thead th:not(:first-child)) { text-align: right; font-variant-numeric: tabular-nums; }
#visu-tools .vt-calc .vt-table td { white-space: nowrap; color: var(--vt-ink); }
#visu-tools .vt-calc .vt-table tbody tr:last-child :is(th, td) { border-bottom: 0; }

/* Method section: how every number is made, the formulas, the sources. */
#visu-tools .vt-calc-method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 40px; }
#visu-tools .vt-calc-method h3 { font-size: 17px !important; font-weight: 680 !important; margin-bottom: 6px !important; }
#visu-tools .vt-calc-method p { font-size: 15.5px; }
#visu-tools .vt-calc-formulas, #visu-tools .vt-calc-sources { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--vt-line); }
#visu-tools .vt-calc-formulas dl { display: grid; gap: 8px; margin: 10px 0 0 !important; }
#visu-tools .vt-calc-formulas dl > div { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 4px 18px; padding: 10px 14px; border: 1px solid var(--vt-line); border-radius: 12px; background: var(--vt-bg); }
#visu-tools .vt-calc-formulas dt { font-size: 14.5px; font-weight: 650; color: var(--vt-ink); }
#visu-tools .vt-calc-formulas dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; color: var(--vt-ink); overflow-wrap: anywhere; }
#visu-tools .vt-calc-sources ul { margin-top: 10px !important; padding-left: 20px !important; display: grid; gap: 6px; font-size: 15px; }

@media (max-width: 860px) {
  #visu-tools .vt-calc-method-grid { grid-template-columns: 1fr; }
  #visu-tools .vt-calc-formulas dl > div { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  #visu-tools .vt-calc-grid:is(.vt-calc-cols-3, .vt-calc-cols-4) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #visu-tools .vt-calc .vt-seg-items { flex-wrap: wrap; overflow-x: visible; margin: 0; padding: 0; }
  #visu-tools .vt-calc .vt-table :is(th, td) { padding: 8px 10px; }
}
html.vt-embed #visu-tools .vt-calc-method { display: none !important; }

/* Print sheet: the table for the counter, alone on the page. calc-kit.js sets html.vt-calc-printing around window.print(). */
@media screen { #visu-tools .vt-calc-sheet { display: none !important; } }
@media print {
  html.vt-calc-printing body * { visibility: hidden !important; }
  /* The sheet stays in normal flow so a long table runs onto more pages: a fixed sheet in a one-screen page was cut after the first.
     What is not the sheet or on the way to it takes no space, or the hidden page would print as extra blank pages. */
  html.vt-calc-printing, html.vt-calc-printing body { height: auto !important; min-height: 0 !important; overflow: visible !important; }
  html.vt-calc-printing body *:not(.vt-calc-sheet, .vt-calc-sheet *, :has(.vt-calc-sheet)) { display: none !important; }
  html.vt-calc-printing body :has(.vt-calc-sheet) { display: block !important; height: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; border: 0 !important; overflow: visible !important; transform: none !important; position: static !important; }
  html.vt-calc-printing #visu-tools .vt-app-band { clip-path: none !important; box-shadow: none !important; }
  html.vt-calc-printing #visu-tools .vt-calc-sheet, html.vt-calc-printing #visu-tools .vt-calc-sheet * { visibility: visible !important; }
  html.vt-calc-printing #visu-tools .vt-calc-sheet { display: block !important; position: static; width: 100%; padding: 12mm; box-sizing: border-box; color: #0a1324; background: #fff; }
  html.vt-calc-printing #visu-tools .vt-calc-sheet-title { font-size: 26pt; font-weight: 750; line-height: 1.15; }
  html.vt-calc-printing #visu-tools .vt-calc-sheet-sub { font-size: 15pt; margin-top: 3mm !important; }
  html.vt-calc-printing #visu-tools .vt-calc-sheet table { width: 100%; border-collapse: collapse; margin-top: 8mm; font-size: 15pt; }
  html.vt-calc-printing #visu-tools .vt-calc-sheet :is(th, td) { text-align: left; padding: 3mm 2mm; border: 0; border-bottom: .2mm solid #b9c2cf; background: none; font-variant-numeric: tabular-nums; }
  html.vt-calc-printing #visu-tools .vt-calc-sheet thead { display: table-header-group; }
  html.vt-calc-printing #visu-tools .vt-calc-sheet tr { break-inside: avoid; }
  html.vt-calc-printing #visu-tools .vt-calc-sheet th { font-size: 11pt; color: #5d6a7e; font-weight: 600; }
  html.vt-calc-printing #visu-tools .vt-calc-sheet :is(th, td):not(:first-child) { text-align: right; }
  html.vt-calc-printing #visu-tools .vt-calc-sheet-note { font-size: 10pt; color: #33415a; margin-top: 6mm !important; }
  html.vt-calc-printing #visu-tools .vt-calc-sheet-foot { font-size: 8pt; color: #5d6a7e; margin-top: 8mm !important; }
}
