/* FreelanceCalc - two themes (light / dark) driven by [data-theme] on <html>. */
:root {
  --bg: #f5f8f7;
  --surface: #ffffff;
  --surface-2: #edf4f2;
  --text: #10201d;
  --muted: #4a5c58;
  --border: #d6e2df;
  --primary: #0f766e;
  --primary-hover: #0b5f58;
  --primary-ink: #ffffff;
  --primary-soft: #dff2ee;
  --accent: #f59e0b;
  --accent-soft: #fff4dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --success: #067647;
  --success-soft: #e3f6ec;
  --ad-bg: #eef1f0;
  --shadow: 0 1px 2px rgba(16, 32, 29, .06), 0 8px 24px rgba(16, 32, 29, .06);
  --footer-bg: #0b3d38;
  --footer-text: #e8f3f1;
  --footer-muted: #a9c7c2;
  --footer-accent: #5eead4;
  --footer-line: #1d5751;
  --radius: 14px;
  --radius-sm: 10px;
  --max: 1180px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a1315;
  --surface: #101c1f;
  --surface-2: #162a2d;
  --text: #e5eeec;
  --muted: #9db2ae;
  --border: #243a3e;
  --primary: #2dd4bf;
  --primary-hover: #5eead4;
  --primary-ink: #042321;
  --primary-soft: #0f3532;
  --accent: #fbbf24;
  --accent-soft: #3a2d0c;
  --danger: #ff8a80;
  --danger-soft: #3b1715;
  --success: #4ade80;
  --success-soft: #0f2e1d;
  --ad-bg: #142225;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25);
  --footer-bg: #060d0f;
  --footer-text: #e5eeec;
  --footer-muted: #93a9a5;
  --footer-accent: #5eead4;
  --footer-line: #1a2a2d;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  transition: background-color .2s, color .2s;
}
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { line-height: 1.25; margin: 1.4em 0 .5em; }
h1 { font-size: clamp(1.6rem, 1rem + 2vw, 2.25rem); margin-top: .3em; letter-spacing: -.02em; }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.6rem); letter-spacing: -.01em; }
h3 { font-size: 1.15rem; }
p, ul, ol { margin: 0 0 1em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.muted { color: var(--muted); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--primary); color: var(--primary-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.logo:hover { color: var(--text); }
.logo-mark { width: 36px; height: 36px; flex: none; display: block; }
.logo span b { color: var(--primary); }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--text); text-decoration: none; padding: 10px 12px; border-radius: 8px; font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--surface-2); color: var(--primary); }
.icon-btn {
  min-width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; display: inline-grid; place-items: center;
  font-size: 1.1rem;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.theme-btn { display: inline-flex; gap: 8px; padding: 0 12px; font-size: .9rem; font-weight: 600; }
.theme-btn > span { display: inline-flex; align-items: center; gap: 6px; }
.theme-btn .t-dark, :root[data-theme="dark"] .theme-btn .t-light { display: none; }
:root[data-theme="dark"] .theme-btn .t-dark { display: inline-flex; }
.nav svg, .theme-btn svg { width: 18px; height: 18px; flex: none; }
.nav a { gap: 6px; }
.menu-btn { display: none; }
@media (max-width: 960px) {
  .menu-btn { display: inline-grid; margin-left: auto; }
  .nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 16px 16px; box-shadow: var(--shadow);
  }
  .nav.open { display: flex; }
  .theme-btn .t-label { display: inline; }
}

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s;
}
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); color: var(--primary-ink); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: .9rem; }

label { font-weight: 600; display: block; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 11px 12px; min-height: 48px;
}
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[aria-invalid="true"] { border-color: var(--danger); }
input[type="range"] { padding: 0; border: 0; min-height: 44px; accent-color: var(--primary); background: transparent; box-shadow: none; }

/* ---------- Layout ---------- */
main { padding: 24px 0 56px; }
.page-grid { display: grid; gap: 32px; grid-template-columns: minmax(0, 1fr); }
.calc { grid-template-columns: minmax(0, 1fr); }
.calc-head h1 { overflow-wrap: anywhere; }
@media (min-width: 1100px) {
  .page-grid.with-sidebar { grid-template-columns: minmax(0, 1fr) 300px; }
}
.sidebar { display: none; }
@media (min-width: 1100px) {
  .sidebar { display: block; }
  .sidebar-inner { position: sticky; top: 88px; display: grid; gap: 20px; }
}
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
@media (min-width: 640px) { .card-pad { padding: 28px; } }
.prose { max-width: 760px; }
.prose li { margin-bottom: .35em; }

.breadcrumbs { font-size: .9rem; color: var(--muted); margin-bottom: 8px; }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }

/* ---------- Ad slots (FR-32: reserved height to avoid layout shift) ---------- */
.ad-slot {
  display: grid; place-items: center; background: var(--ad-bg); border-radius: var(--radius-sm);
  color: var(--muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase;
  border: 1px dashed var(--border); margin: 28px 0; overflow: hidden;
}
.ad-top { min-height: 100px; }
.ad-after { min-height: 250px; }
@media (min-width: 728px) { .ad-top { min-height: 90px; } }
.ad-sidebar { min-height: 250px; margin: 0; }
/* Exact ad size per screen width (AdSense "responsive ad unit, exact size" method) */
.ad-ins { display: inline-block; width: 100%; }
.ad-ins-top { height: 100px; }
@media (min-width: 728px) { .ad-ins-top { width: 728px; max-width: 100%; height: 90px; } }
.ad-ins-afterResults { height: 250px; }
.ad-ins-sidebar { width: 300px; height: 250px; }
.ad-slot { position: relative; }
.ad-slot.live::before { content: "Advertisement"; position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.ad-slot.live ins { position: relative; z-index: 1; width: 100%; }
.ad-slot.live:has(ins[data-ad-status="filled"]) { background: transparent; border-color: transparent; }
.ad-slot.live:has(ins[data-ad-status="filled"])::before { content: none; }

/* ---------- Home ---------- */
.hero { padding: 40px 0 16px; display: grid; gap: 28px; align-items: center; }
@media (min-width: 900px) { .hero { grid-template-columns: 1.2fr 1fr; padding: 56px 0 24px; } }
.hero h1 { font-size: clamp(1.9rem, 1rem + 2.6vw, 2.75rem); }
.hero h1 em { font-style: normal; color: var(--primary); }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.trust { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 22px; color: var(--muted); font-size: .92rem; padding: 0; list-style: none; }
.trust li::before { content: "✓ "; color: var(--success); font-weight: 700; }
.hero-preview { padding: 22px; }
.hero-preview .big { font-size: 2.4rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.hero-preview dl { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 16px 0 0; font-size: .95rem; }
.hero-preview dt { color: var(--muted); }
.hero-preview dd { margin: 0; font-weight: 700; text-align: right; }

.section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin: 40px 0 16px; }
.section-head h2 { margin: 0; }
.calc-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.calc-tile { display: flex; flex-direction: column; gap: 6px; padding: 20px; text-decoration: none; color: var(--text); transition: transform .15s, border-color .15s; }
.calc-tile:hover { transform: translateY(-2px); border-color: var(--primary); color: var(--text); }
.calc-tile .ic { width: 46px; height: 46px; border-radius: 13px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 1.3rem; margin-bottom: 6px; }
.calc-tile .ic svg { width: 24px; height: 24px; }
button.calc-tile { font: inherit; text-align: left; cursor: pointer; width: 100%; }
.ask-tile { background: linear-gradient(140deg, var(--primary-soft), var(--accent-soft)); border-style: dashed; border-color: var(--primary); }
.ask-tile .ic { background: var(--primary); color: var(--primary-ink); }
.calc-tile h3 { margin: 0; font-size: 1.05rem; }
.calc-tile p { margin: 0; color: var(--muted); font-size: .93rem; }
.calc-tile .go { margin-top: auto; padding-top: 8px; color: var(--primary); font-weight: 700; font-size: .92rem; }

.post-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.post-card { padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.post-card h3 { margin: 0; font-size: 1.1rem; }
.post-card h3 a { color: var(--text); text-decoration: none; }
.post-card h3 a:hover { color: var(--primary); }
.post-card p { margin: 0; color: var(--muted); font-size: .95rem; }
.chip { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); text-decoration: none; width: fit-content; }
.meta { font-size: .88rem; color: var(--muted); }
.cat-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; }
.cat-list a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text); font-weight: 600; font-size: .92rem; }
.cat-list a:hover, .cat-list a[aria-current="page"] { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* ---------- Newsletter ---------- */
.newsletter { padding: 24px; background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft)); border: 1px solid var(--border); border-radius: var(--radius); }
.newsletter h2, .newsletter h3 { margin-top: 0; }
.nl-form { display: grid; gap: 10px; margin-top: 12px; }
@media (min-width: 640px) { .nl-form { grid-template-columns: 1fr 1.3fr auto; } }
.nl-form label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.form-msg { margin: 10px 0 0; font-weight: 600; color: var(--success); }
.form-msg.err { color: var(--danger); }

/* ---------- Calculator ---------- */
.calc-head p.lead { font-size: 1.08rem; color: var(--muted); max-width: 760px; }
.calc { display: grid; overflow: hidden; }
@media (min-width: 900px) { .calc { grid-template-columns: 1.05fr 1fr; } }
.calc-inputs { padding: 20px; }
.calc-results { padding: 20px; background: var(--surface-2); border-top: 1px solid var(--border); }
@media (min-width: 640px) { .calc-inputs, .calc-results { padding: 28px; } }
@media (min-width: 900px) { .calc-results { border-top: 0; border-left: 1px solid var(--border); } }
.calc-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.calc-toolbar h2 { margin: 0; font-size: 1.15rem; }
.currency { display: flex; align-items: center; gap: 8px; }
.currency label { margin: 0; font-size: .88rem; color: var(--muted); font-weight: 600; }
.currency select { width: auto; min-height: 44px; padding: 6px 10px; }
.field { margin-bottom: 16px; }
.field .hint { font-size: .85rem; color: var(--muted); margin: 5px 0 0; }
.field-error { color: var(--danger); font-size: .88rem; font-weight: 600; margin: 6px 0 0; min-height: 0; }
.field-error:empty { display: none; }
.input-wrap { position: relative; display: flex; align-items: stretch; }
.input-wrap .affix {
  display: grid; place-items: center; min-width: 46px; padding: 0 10px; background: var(--surface-2);
  border: 1.5px solid var(--border); color: var(--muted); font-weight: 700; font-size: .95rem;
}
.input-wrap .affix { flex: none; padding: 0 14px; white-space: nowrap; }
.input-wrap input { flex: 1 1 auto; min-width: 0; }
/* Hide number spinners: they crowd the field and are useless on touch screens */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input-wrap .pre { border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-wrap .post { border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-wrap .pre + input { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-wrap input:has(+ .post) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.range-row { display: flex; align-items: center; gap: 14px; }
.range-row output { min-width: 92px; text-align: center; font-weight: 800; background: var(--primary-soft); color: var(--primary); border-radius: 10px; padding: 8px; }
.calc-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.calc-actions .btn-primary { flex: 1 1 180px; }
.row-2 { display: grid; gap: 0 12px; grid-template-columns: repeat(3, 1fr); }
details.custom { margin: 0 0 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 14px; background: var(--surface); }
details.custom summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
details.custom[open] { padding-bottom: 6px; }

.list-rows { display: grid; gap: 8px; margin-bottom: 8px; }
.exp-row { display: grid; grid-template-columns: 1fr 110px 44px; gap: 8px; }
.exp-row input, .exp-row select { min-height: 44px; padding: 8px 10px; }
.exp-row .exp-bucket { grid-column: 1 / 3; }
@media (min-width: 560px) {
  .exp-row { grid-template-columns: 1.3fr 1fr 1fr 44px; }
  .exp-row .exp-bucket { grid-column: auto; }
}
.exp-row .rm { grid-row: 1; grid-column: 3; }
@media (min-width: 560px) { .exp-row .rm { grid-column: 4; } }
.months-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 12px; }
@media (min-width: 560px) { .months-grid { grid-template-columns: repeat(3, 1fr); } }
.months-grid label { font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.months-grid input { min-height: 44px; padding: 8px 10px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 700; margin-bottom: 8px; padding: 0; }

.results-empty { color: var(--muted); text-align: center; padding: 40px 10px; }
.result-main { text-align: left; }
.result-main .label { color: var(--muted); font-weight: 600; font-size: .95rem; }
.result-main .value { font-size: clamp(1.9rem, 1rem + 2.5vw, 2.4rem); font-weight: 800; color: var(--primary); line-height: 1.15; letter-spacing: -.02em; }
.result-main .value small { font-size: 1rem; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.stat .k { font-size: .82rem; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 1.15rem; font-weight: 800; word-break: break-word; }
.stat.good .v { color: var(--success); }
.stat.bad .v { color: var(--danger); }
.result-note { font-size: .9rem; color: var(--muted); }
.result-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge.good { background: var(--success-soft); color: var(--success); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }

.bars { display: grid; gap: 14px; margin: 16px 0; }
.bar-row .bar-head { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; margin-bottom: 4px; flex-wrap: wrap; }
.bar-track { position: relative; height: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--primary); border-radius: 999px; }
.bar-fill.over { background: var(--danger); }
.bar-target { position: absolute; top: -3px; bottom: -3px; width: 3px; background: var(--text); opacity: .65; }
.progress { height: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.progress span { display: block; height: 100%; background: var(--primary); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); margin: 12px 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--surface-2); font-weight: 700; font-size: .82rem; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tr.best td { background: var(--success-soft); font-weight: 700; }

.calc-content { margin-top: 8px; }
.calc-content section { margin-top: 8px; }
.formula-box { background: var(--surface); border-left: 4px solid var(--primary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 14px 18px; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 700; min-height: 48px; list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; color: var(--primary); }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 18px 14px; margin: 0; color: var(--muted); }
.related-list { display: grid; gap: 10px; padding: 0; list-style: none; }
.related-list a { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; font-weight: 600; }
.related-list a:hover { border-color: var(--primary); }
.side-box { padding: 18px; }
.side-box h3 { margin: 0 0 10px; font-size: 1rem; }
.side-box ul { margin: 0; padding-left: 18px; }
.side-box li { margin-bottom: 6px; }

/* ---------- Post ---------- */
.post-header { max-width: 760px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .92rem; margin-bottom: 20px; }
.disclosure { background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; font-size: .92rem; margin-bottom: 20px; }
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 20px; margin-bottom: 24px; }
.toc h2 { font-size: 1rem; margin: 0 0 8px; }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin-bottom: 4px; }
.related-calc { display: flex; gap: 16px; align-items: center; padding: 20px; margin: 28px 0; border: 2px solid var(--primary); }
.related-calc .ic { flex: none; width: 52px; height: 52px; border-radius: 14px; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; font-size: 1.5rem; }
.related-calc .ic svg { width: 26px; height: 26px; }
.related-calc h3 { margin: 0 0 4px; }
.related-calc p { margin: 0 0 8px; color: var(--muted); }
.author-box { display: flex; gap: 16px; padding: 20px; margin: 28px 0; }
.avatar { flex: none; width: 56px; height: 56px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; }
.avatar .logo-mark { width: 56px; height: 56px; }
.author-box p { margin: 0; color: var(--muted); }

/* ---------- Search ---------- */
.search-form { display: flex; gap: 10px; margin: 16px 0 24px; }
.search-results { display: grid; gap: 12px; padding: 0; list-style: none; }
.search-results li { padding: 16px 18px; }
.search-results h3 { margin: 0 0 4px; font-size: 1.05rem; }
.search-results p { margin: 0; color: var(--muted); font-size: .93rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer-bg); color: var(--footer-text); margin-top: 120px; padding: 0 0 84px; }
/* Desktop: little bottom space; keep the last line clear of the floating "Ask AI" button */
@media (min-width: 641px) { .site-footer { padding-bottom: 28px; } .footer-bottom { padding-right: 170px; } }
.site-footer a { color: var(--footer-text); }
.site-footer h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--footer-accent); margin: 0 0 14px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer .logo { color: var(--footer-text); }
.site-footer .logo span b { color: var(--footer-accent); }

.footer-cta {
  position: relative; top: -64px; margin-bottom: -24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 28px;
  padding: 28px; border-radius: 20px; color: #fff;
  background: linear-gradient(120deg, #0f766e 0%, #0d9488 55%, #14b8a6 100%); box-shadow: 0 16px 40px rgba(15, 118, 110, .35);
}
.footer-cta h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); text-transform: none; letter-spacing: -.01em; color: #fff; margin: 0 0 6px; }
.footer-cta p { margin: 0; color: #e6fffb; max-width: 520px; }
.footer-cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-accent { background: #fbbf24; color: #1f1300; }
.btn-accent:hover { background: #fcd34d; color: #1f1300; }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .7); }
.btn-outline-light:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.btn-outline-light svg { width: 18px; height: 18px; }

.footer-grid { display: grid; gap: 32px 24px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.f-brand { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
  .f-brand { grid-column: auto; padding-right: 24px; }
}
.f-brand p { color: var(--footer-muted); margin: 14px 0 16px; max-width: 360px; }
.f-contact li { display: flex; align-items: center; gap: 10px; color: var(--footer-muted); font-size: .92rem; margin-bottom: 10px; }
.f-contact a { display: inline-flex; align-items: center; gap: 10px; color: var(--footer-text); text-decoration: none; min-height: 44px; }
.f-contact a:hover { color: var(--footer-accent); }
.f-contact svg { width: 18px; height: 18px; flex: none; color: var(--footer-accent); }
.f-col li a { display: inline-flex; align-items: center; min-height: 36px; color: var(--footer-muted); text-decoration: none; font-size: .95rem; }
.f-col li a:hover { color: var(--footer-accent); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; border-top: 1px solid var(--footer-line); margin-top: 36px; padding-top: 20px; font-size: .85rem; color: var(--footer-muted); }
.footer-bottom p { margin: 0; }
.footer-bottom a { color: var(--footer-accent); }
.site-footer :focus-visible { outline-color: #fbbf24; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 200; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- Language picker + translation bar ---------- */
.lang-pick { position: relative; display: inline-flex; align-items: center; margin: 0; font-weight: 600; }
.lang-pick svg { position: absolute; left: 11px; width: 18px; height: 18px; pointer-events: none; color: var(--text); }
.lang-pick select { width: auto; max-width: 150px; min-height: 44px; padding: 6px 28px 6px 36px; border-radius: 10px; font-size: .9rem; font-weight: 600; cursor: pointer; }
.lang-bar { background: var(--accent-soft); border-bottom: 1px solid var(--border); font-size: .92rem; }
.lang-bar .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-top: 8px; padding-bottom: 8px; }
.lang-bar[hidden] { display: none; }
.lang-bar-actions { display: flex; gap: 8px; }
/* Hide Google Translate's own toolbar, tooltips and highlight */
iframe.skiptranslate, .skiptranslate > iframe, .goog-te-banner-frame, #goog-gt-tt, .goog-te-balloon-frame,
.VIpgJd-ZVi9od-ORHb-OEVmcd, .VIpgJd-ZVi9od-aZ2wEe-wOHMyf, .VIpgJd-yAWNEb-L7lbkb { display: none !important; }
body { top: 0 !important; }
.goog-text-highlight, font[style] { background: none !important; box-shadow: none !important; }
#gt-el { display: none; }

/* ---------- AI assistant ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chat-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 90; display: inline-flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 0 20px 0 16px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--primary); color: var(--primary-ink); font: inherit; font-weight: 800;
  box-shadow: 0 6px 20px rgba(15, 118, 110, .35);
}
.chat-fab:hover { background: var(--primary-hover); }
.chat-fab svg { width: 22px; height: 22px; }
.chat-fab[aria-expanded="true"] { display: none; }
@media (max-width: 640px) {
  .chat-fab { width: 56px; height: 56px; padding: 0; justify-content: center; }
  .chat-fab span { display: none; }
  .chat-fab svg { width: 26px; height: 26px; }
}
body:has(main :is(input, textarea, select):focus) .chat-fab { opacity: 0; pointer-events: none; }
.chat-panel {
  position: fixed; right: 16px; bottom: 16px; z-index: 95; display: flex; flex-direction: column;
  width: min(390px, calc(100vw - 32px)); height: min(600px, calc(100vh - 32px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); overflow: hidden;
}
.chat-panel[hidden] { display: none; }
@media (max-width: 520px) { .chat-panel { right: 8px; left: 8px; bottom: 8px; width: auto; height: calc(100dvh - 16px); } }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.chat-head > div { flex: 1; min-width: 0; }
.chat-head strong { display: block; font-size: 1rem; }
.chat-head span { display: block; font-size: .82rem; color: var(--muted); }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: .95rem; line-height: 1.5; overflow-wrap: anywhere; }
.msg p, .msg ul, .msg ol { margin: 0 0 .5em; }
.msg > :last-child { margin-bottom: 0; }
.msg ul, .msg ol { padding-left: 20px; }
.msg.bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.user { align-self: flex-end; background: var(--primary); color: var(--primary-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg .src { display: block; margin-top: 6px; font-size: .78rem; color: var(--muted); }
.typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.chat-suggest[hidden] { display: none; }
.chip-btn { font: inherit; font-size: .85rem; min-height: 44px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--primary); cursor: pointer; text-align: left; }
.chip-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.chat-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); }
.chat-form textarea { min-height: 48px; max-height: 120px; resize: none; padding: 12px; }
.chat-send { min-width: 52px; padding: 0 14px; font-size: 1.1rem; }
.chat-note { margin: 0; padding: 0 14px 10px; font-size: .74rem; color: var(--muted); text-align: center; }
@media print { .chat-fab, .chat-panel { display: none !important; } }

/* ---------- Fit every screen ----------
   Laptops and small desktops (often running Windows at 125-150% scaling) get a
   slightly smaller root size and tighter controls; phones keep 16px text and
   44px tap targets; very wide screens get a wider content column. */
@media (min-width: 961px) {
  html { font-size: clamp(14px, calc(8.6px + .5vw), 16px); }
  .header-inner { min-height: 3.75rem; }
  .nav a { min-height: 2.5rem; padding: .45rem .7rem; }
  .icon-btn { height: 2.5rem; min-width: 2.5rem; }
  .lang-pick select { min-height: 2.5rem; }
  .btn { min-height: 2.75rem; padding: 0 1.25rem; }
  .btn-sm { min-height: 2.5rem; padding: 0 .9rem; }
  input, select, textarea { min-height: 2.75rem; padding: .55rem .75rem; }
  .card-pad, .calc-inputs, .calc-results { padding: 1.5rem; }
  .field { margin-bottom: .9rem; }
  .sidebar-inner { top: 76px; }
  .chat-fab { min-height: 2.9rem; }
}
@media (min-width: 1600px) { :root { --max: 1280px; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .site-header, .site-footer, .ad-slot, .sidebar, .calc-actions, .result-tools, .newsletter { display: none !important; }
}
