/* CalculatorsPlatform — calculator page + shared calculator UI kit */
.cp-calc { margin: 4px 0 28px; }
.cp-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; margin: 6px 0 16px; }
.cp-title { flex: 1 1 420px; min-width: 0; }
.cp-title h1 { font-size: clamp(26px, 3.4vw, 36px); margin: 4px 0 6px; letter-spacing: -0.025em; }
.cp-intro { margin: 0; color: var(--muted); font-size: 16.5px; max-width: 760px; }
.cp-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cp-tool { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text2); font: inherit; font-size: 14px; cursor: pointer; }
.cp-tool:hover { border-color: var(--line2); color: var(--text); }
.cp-tool svg { width: 16px; height: 16px; display: block; }
.cp-fav svg { fill: none; }
.cp-fav[aria-pressed="true"] { color: #d97706; border-color: #f59e0b; }
.cp-fav[aria-pressed="true"] svg { fill: #f59e0b; }
.cp-units { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; height: 36px; background: var(--surface); }
.cp-units button { border: 0; background: none; color: var(--text2); font: inherit; font-size: 14px; padding: 0 12px; cursor: pointer; }
.cp-units button + button { border-left: 1px solid var(--line); }
.cp-units button[aria-checked="true"] { background: var(--accent); color: #fff; }
.cp-cur select { height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text2); font: inherit; font-size: 14px; padding: 0 8px; cursor: pointer; }
@media (max-width: 560px) { .cp-tool-t { display: none; } .cp-tool { padding: 0 10px; } }

.cp-loading { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 18px; }
.cp-loading span { height: 340px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 30%, var(--surface2) 50%, var(--surface) 70%); background-size: 300% 100%; animation: cp-sh 1.4s infinite linear; border: 1px solid var(--line); }
@keyframes cp-sh { to { background-position: -150% 0; } }
@media (max-width: 860px) { .cp-loading { grid-template-columns: 1fr; } .cp-loading span:last-child { display: none; } }

/* ---------- layout ---------- */
.cp-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 18px; align-items: start; }
.cp-layout.cp-wide-in { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cp-layout.cp-single { grid-template-columns: minmax(0, 1fr); }
.cp-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.cp-results { position: sticky; top: 118px; }
.cp-single .cp-results { position: static; }
.cp-full { margin-top: 18px; }
.cp-full:empty { display: none; }
.cp-full > .cp-card + .cp-card { margin-top: 18px; }
@media (max-width: 860px) {
  .cp-layout, .cp-layout.cp-wide-in { grid-template-columns: minmax(0, 1fr); }
  .cp-results { position: static; }
  .cp-card { padding: 16px; }
}
.cp-card-h { font-size: 17px; margin: 0 0 14px; }

/* ---------- forms ---------- */
.cp-form { display: flex; flex-direction: column; gap: 14px; }
.cp-form-compact { gap: 10px; }
.cp-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cp-row[data-kind="third"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 380px) { .cp-row[data-kind="third"] { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cp-form-heading { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 6px; border-top: 1px solid var(--line); margin-top: 2px; }
.cp-form-heading:first-child { border-top: 0; padding-top: 0; }
.cp-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cp-label { font-size: 14px; font-weight: 600; color: var(--text2); }
.cp-help { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.cp-err { font-size: 12.5px; color: var(--bad); min-height: 0; }
.cp-err:empty { display: none; }
.cp-input-wrap { position: relative; display: flex; align-items: stretch; border: 1.5px solid var(--line2); border-radius: var(--radius-s); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.cp-input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.cp-invalid .cp-input-wrap { border-color: var(--bad); }
.cp-input { flex: 1; min-width: 0; width: 100%; height: 44px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 16.5px; padding: 0 12px; font-variant-numeric: tabular-nums; }
.cp-input:focus { outline: none; }
.cp-input[type="date"], .cp-input[type="time"], .cp-input[type="datetime-local"] { font-size: 16px; min-height: 44px; }
.cp-textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; border: 1.5px solid var(--line2); border-radius: var(--radius-s); font-family: var(--mono); font-size: 15px; }
.cp-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.cp-pre, .cp-suf { display: flex; align-items: center; padding: 0 11px; color: var(--muted); font-size: 15px; white-space: nowrap; background: var(--surface2); }
.cp-pre { border-right: 1px solid var(--line); border-radius: 8px 0 0 8px; }
.cp-suf { border-left: 1px solid var(--line); border-radius: 0 8px 8px 0; }
.cp-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cp-select-wrap { position: relative; }
.cp-select { width: 100%; height: 47px; border: 1.5px solid var(--line2); border-radius: var(--radius-s); background: var(--surface); color: var(--text); font: inherit; font-size: 16px; padding: 0 36px 0 12px; appearance: none; -webkit-appearance: none; cursor: pointer; }
.cp-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.cp-select-wrap::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.cp-seg { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 3px; gap: 3px; }
.cp-seg button { border: 0; background: none; color: var(--text2); font: inherit; font-size: 14.5px; padding: 8px 6px; border-radius: 7px; cursor: pointer; min-height: 38px; line-height: 1.25; }
.cp-seg button:hover { color: var(--text); }
.cp-seg button[aria-checked="true"] { background: var(--surface); color: var(--accent); font-weight: 650; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
@media (max-width: 420px) { .cp-seg[style*="--n:4"], .cp-seg[style*="--n:5"], .cp-seg[style*="--n:6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cp-check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text2); cursor: pointer; padding: 4px 0; }
.cp-check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.cp-form-actions { display: flex; gap: 10px; padding-top: 2px; }
.cp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 20px; border-radius: var(--radius-s); border: 1.5px solid var(--line2); background: var(--surface); color: var(--text); font: inherit; font-size: 15.5px; font-weight: 600; cursor: pointer; }
.cp-btn:hover { border-color: var(--accent); color: var(--accent); }
.cp-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; min-width: 140px; }
.cp-btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); color: #fff; }
.cp-btn-ghost { height: 34px; padding: 0 12px; font-size: 13.5px; font-weight: 550; border-width: 1px; }
.cp-btn-sm { height: 34px; padding: 0 12px; font-size: 14px; }
.cp-btn-icon { width: 36px; height: 36px; padding: 0; }

/* ---------- results ---------- */
.cp-results > * + * { margin-top: 16px; }
.cp-hero { background: var(--accent-soft); border-radius: 12px; padding: 16px 18px; }
.cp-hero-label { font-size: 14px; color: var(--text2); font-weight: 600; }
.cp-hero-value { font-size: clamp(30px, 4.2vw, 42px); font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; color: var(--accent); font-variant-numeric: tabular-nums; margin-top: 2px; word-break: break-word; }
.cp-hero-sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
.cp-hero.cp-good { background: var(--good-soft); } .cp-hero.cp-good .cp-hero-value { color: var(--good); }
.cp-hero.cp-bad { background: var(--bad-soft); } .cp-hero.cp-bad .cp-hero-value { color: var(--bad); }
.cp-hero.cp-warn { background: var(--warn-soft); } .cp-hero.cp-warn .cp-hero-value { color: var(--warn); }
.cp-stats { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .cp-stats { grid-template-columns: repeat(min(var(--cols, 2), 2), minmax(0, 1fr)); } }
.cp-stat { border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; min-width: 0; }
.cp-stat-label { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.cp-stat-value { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; word-break: break-word; line-height: 1.3; }
.cp-stat-sub { font-size: 12px; color: var(--muted); }
.cp-stat.cp-good .cp-stat-value { color: var(--good); } .cp-stat.cp-bad .cp-stat-value { color: var(--bad); } .cp-stat.cp-warn .cp-stat-value { color: var(--warn); } .cp-stat.cp-accent .cp-stat-value { color: var(--accent); }
.cp-list { margin: 0; display: flex; flex-direction: column; }
.cp-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.cp-list > div:last-child { border-bottom: 0; }
.cp-list dt { color: var(--text2); }
.cp-list dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.cp-list .cp-strong { border-top: 2px solid var(--line2); border-bottom: 0; font-size: 16px; }
.cp-list .cp-strong dt, .cp-list .cp-strong dd { font-weight: 750; color: var(--text); }
.cp-list .cp-good dd { color: var(--good); } .cp-list .cp-bad dd { color: var(--bad); }
.cp-sub-h { font-size: 15px; font-weight: 700; margin: 4px 0 8px; }
.cp-note { border-radius: 11px; padding: 11px 14px; font-size: 14.5px; line-height: 1.5; background: var(--info-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.cp-note.cp-good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 28%, transparent); }
.cp-note.cp-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.cp-note.cp-bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.cp-empty { color: var(--muted); text-align: center; padding: 40px 10px; font-size: 15px; }
.cp-formula { font-family: var(--mono); font-size: 14.5px; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; overflow-x: auto; white-space: nowrap; }
.cp-steps ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.cp-steps li { padding-left: 4px; }
.cp-steps code, .cp-results code { font-family: var(--mono); font-size: .93em; background: var(--surface2); padding: 1px 5px; border-radius: 5px; }

.cp-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
.cp-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.cp-table caption { text-align: left; font-weight: 700; padding: 10px 12px 4px; }
.cp-table th, .cp-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cp-table th { background: var(--surface2); font-size: 12.5px; color: var(--muted); font-weight: 650; position: sticky; top: 0; }
.cp-table .r { text-align: right; } .cp-table .c { text-align: center; }
.cp-table tbody tr:hover { background: var(--surface2); }
.cp-table tbody tr:last-child td { border-bottom: 0; }
.cp-table tfoot td { font-weight: 700; border-top: 2px solid var(--line2); border-bottom: 0; }
.cp-table.cp-compact th, .cp-table.cp-compact td { padding: 6px 10px; }
.cp-table-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.cp-pbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface2); }
.cp-pbar span { display: block; height: 100%; min-width: 2px; }
.cp-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; color: var(--text2); margin-top: 8px; }
.cp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cp-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.cp-legend small { color: var(--muted); }
.cp-legend-col { flex-direction: column; justify-content: center; }

.cp-gauge { padding: 30px 0 4px; }
.cp-gauge-track { position: relative; height: 12px; border-radius: 6px; background: var(--surface2); }
.cp-gauge-track > span { position: absolute; top: 0; bottom: 0; }
.cp-gauge-track > span:first-child { border-radius: 6px 0 0 6px; }
.cp-gauge-track > span:nth-last-child(2) { border-radius: 0 6px 6px 0; }
.cp-gauge-mark { position: absolute; top: -6px; width: 4px; height: 24px; margin-left: -2px; background: var(--text); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); transition: left .35s cubic-bezier(.2, .8, .2, 1); }
.cp-gauge-mark em { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 13px; font-weight: 700; background: var(--text); color: var(--surface); padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.cp-gauge-labels { position: relative; height: 34px; }
.cp-gauge-labels small { position: absolute; top: 6px; transform: translateX(-50%); font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.2; max-width: 25%; }

.cp-chart { margin: 0; }
.cp-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.cp-chart .cp-grid { stroke: var(--line); stroke-width: 1; }
.cp-chart .cp-axis { fill: var(--muted); font-size: 11.5px; font-family: var(--font); }
.cp-chart .cp-axis-t { font-size: 12px; }
.cp-chart .cp-guide { stroke: var(--line2); stroke-width: 1; stroke-dasharray: 3 3; }
.cp-donut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }
.cp-donut svg { width: 180px; height: 180px; flex: none; }
.cp-donut path { stroke: var(--surface); stroke-width: 2; cursor: default; }
.cp-donut-v { fill: var(--text); font-size: 20px; font-weight: 750; font-family: var(--font); }
.cp-tip { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12.5px; line-height: 1.5; padding: 7px 10px; border-radius: 8px; box-shadow: var(--shadow-lg); max-width: 260px; }
.cp-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.cp-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 95; background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 14.5px; box-shadow: var(--shadow-lg); transition: opacity .2s, transform .2s; pointer-events: none; }
.cp-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* keypad (scientific calculator & friends) */
.cp-keys { display: grid; grid-template-columns: repeat(var(--kc, 5), minmax(0, 1fr)); gap: 7px; }
.cp-key { height: 50px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface2); color: var(--text); font: inherit; font-size: 17px; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; transition: transform .05s, background .1s; }
.cp-key:hover { border-color: var(--line2); }
.cp-key:active, .cp-key.on { transform: scale(.96); background: var(--line); }
.cp-key.op { color: var(--accent); font-weight: 650; }
.cp-key.fn { font-size: 15px; color: var(--text2); }
.cp-key.eq { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.cp-key.clr { color: var(--bad); }

/* ---------- content below the calculator ---------- */
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; align-items: start; margin-top: 10px; }
@media (max-width: 960px) { .content-grid { grid-template-columns: minmax(0, 1fr); } }
.content { max-width: 800px; font-size: 16.5px; line-height: 1.7; color: var(--text2); }
.content h2 { color: var(--text); font-size: 23px; margin: 34px 0 10px; }
.content h3 { color: var(--text); font-size: 18px; }
.content p { margin: 0 0 14px; }
.content ul, .content ol { padding-left: 22px; margin: 0 0 14px; }
.content li { margin: 4px 0; }
.content code { font-family: var(--mono); font-size: .9em; background: var(--surface2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; color: var(--text); }
.content .formula-line { font-family: var(--mono); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 12px 16px; color: var(--text); overflow-x: auto; white-space: nowrap; font-size: 15px; }
.table-scroll { overflow-x: auto; margin: 0 0 16px; }
.content-table { border-collapse: collapse; width: 100%; font-size: 15px; background: var(--surface); border-radius: 10px; overflow: hidden; }
.content-table th, .content-table td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.content-table th { background: var(--surface2); color: var(--text); }
.toc { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: 14px; margin-top: 8px; }
.toc b { color: var(--text); margin-right: 4px; }
.toc a { background: var(--surface2); padding: 3px 10px; border-radius: 999px; color: var(--text2); }
.toc a:hover { color: var(--accent); text-decoration: none; }
.faq details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 0 0 10px; }
.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 620; color: var(--text); list-style: none; position: relative; padding-right: 42px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--muted); font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding: 0 16px 6px; }
.sources ul { font-size: 14.5px; }
.disclaimer { font-size: 13.5px; color: var(--muted); background: var(--surface2); border-radius: 12px; padding: 12px 16px; margin-top: 28px; line-height: 1.55; }
.updated { font-size: 13px; color: var(--muted); }
.related { position: sticky; top: 118px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 34px; }
.related h2 { font-size: 17px; margin: 0 0 10px; }
.rel-list { list-style: none; margin: 0; padding: 0; }
.rel-list a { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; color: var(--text2); font-size: 15px; }
.rel-list a:hover { background: var(--surface2); color: var(--accent); text-decoration: none; }
.rel-list .card-ic { width: 17px; height: 17px; }
.rel-more { display: block; margin-top: 10px; font-size: 14px; }
@media (max-width: 960px) { .related { position: static; } }

@media print {
  .cp-results { position: static; }
  .cp-card { box-shadow: none; }
}
