/* Útiles BourbeLabs. Layout: centred column up to 1080px, plus a 160px ad rail
   on wide screens. Every colour is a token, with a dark theme. */
:root {
  --bg: #F3F4F8; --paper: #FFFFFF; --ink: #161A2E; --soft: #585E77; --line: #DCDFEA;
  --accent: #2F4BE0; --accent-ink: #FFFFFF; --accent-soft: #E3E8FF; --focus: #F5B82E;
  --ad: #F6F2E6; --ad-ink: #8A7A4A; --good: #1F8A5B; --bad: #B8382A;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0E1122; --paper: #171B31; --ink: #ECEEF8; --soft: #A3A9C4; --line: #2B3150;
    --accent: #7D90FF; --accent-ink: #0E1122; --accent-soft: #232B57; --ad: #1C1F33; --ad-ink: #8C91AE;
    --good: #5CCB95; --bad: #FF8A7A; color-scheme: dark }
}
*, *::before, *::after { box-sizing: border-box }
html { -webkit-text-size-adjust: 100% }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--body) }
a { color: var(--accent) }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; text-wrap: balance; margin: 0 }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -.01em }
h2 { font-size: 1.3rem; margin-top: 8px }
.wrap { max-width: 1080px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)) }

/* Header and footer */
.top { background: var(--paper); border-bottom: 1px solid var(--line) }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px }
.logo { font: 700 1.15rem var(--display); color: var(--ink); text-decoration: none }
.logo b { color: var(--accent) }
.all { font-size: .92rem; text-decoration: none; font-weight: 600 }
.foot { margin-top: 48px; border-top: 1px solid var(--line); background: var(--paper); color: var(--soft); font-size: .88rem }
.foot-in { padding-block: 24px; display: grid; gap: 10px }
.foot p { margin: 0 }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px }
.foot a { color: var(--soft) }

/* Page with optional ad rail */
.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; padding-block: 20px 8px }
.main { display: grid; gap: 18px; min-width: 0; align-content: start }
.rail { display: none }
@media (min-width: 1180px) {
  html.ads-side .page { max-width: 1272px; grid-template-columns: minmax(0, 1fr) 160px }
  html.ads-side .rail { display: block }
  html.ads-side .rail .ad { position: sticky; top: 16px }
}
.crumbs { font-size: .85rem; color: var(--soft) }
.crumbs a { color: var(--soft) }
.lead { margin: 0; color: var(--soft); font-size: 1.08rem; max-width: 70ch }

/* Home */
.hero { display: grid; gap: 8px; padding-block: 8px }
.cat { display: grid; gap: 12px; margin-top: 10px; scroll-margin-top: 12px }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px }
.btn { display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  color: var(--ink); text-decoration: none; min-height: 88px; transition: border-color .15s, transform .15s }
.btn:hover { border-color: var(--accent); transform: translateY(-1px) }
.btn .ic { grid-row: span 2; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font: 700 1.2rem var(--display) }
.btn strong { font-size: 1.02rem; align-self: end }
.btn small { color: var(--soft); font-size: .86rem; align-self: start; line-height: 1.35 }
.btn.big { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) }
.btn.big .ic { background: rgba(255, 255, 255, .18); color: var(--accent-ink) }
.btn.big small { color: var(--accent-ink); opacity: .85 }
@media (min-width: 720px) { .btn.big { grid-column: span 2 } }
@media (prefers-reduced-motion: reduce) { .btn { transition: none } .btn:hover { transform: none } }

/* Tool area */
.tool { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(14px, 3vw, 24px); display: grid; gap: 16px }
.cols { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: start }
.stack { display: grid; gap: 12px; min-width: 0 }
label, .label { font-size: .88rem; font-weight: 600; color: var(--soft); display: grid; gap: 5px }
input[type=text], input[type=number], input[type=date], input[type=url], input[type=email], input[type=tel], input[type=password], select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0 }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none }
textarea { resize: vertical; min-height: 140px }
input[type=range] { width: 100%; accent-color: var(--accent) }
input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--bg) }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink) }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end }
.row > * { flex: 1 1 140px }
.seg { display: flex; flex-wrap: wrap; gap: 6px }
.seg button, .chip { font: 600 .9rem var(--body); border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 7px 14px; cursor: pointer }
.seg button[aria-pressed=true], .chip[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) }
.button { font: 700 1rem var(--body); border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer; background: var(--accent); color: var(--accent-ink); text-align: center; text-decoration: none }
.button.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent) }
.out { background: var(--accent-soft); border-radius: 12px; padding: 16px; display: grid; gap: 6px }
.big-num { font: 700 clamp(1.6rem, 5vw, 2.3rem)/1.1 var(--display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere }
.kv { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 6px; font-variant-numeric: tabular-nums }
.kv b { font-weight: 700 }
.hint { font-size: .85rem; color: var(--soft); margin: 0 }
.mono { font-family: var(--mono) }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0; display: grid; gap: 10px; min-width: 0 }
legend { font-weight: 700; padding: 0 6px }

/* Article and FAQ */
.article { display: grid; gap: 12px; max-width: 75ch }
.article p, .article li { color: var(--ink) }
.article p { margin: 0 }
.article ul, .article ol { margin: 0; padding-left: 22px }
details { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px }
summary { cursor: pointer; font-weight: 700 }
details p { margin-top: 8px; color: var(--soft) }
.updated { font-size: .82rem; color: var(--soft) }
.related { display: grid; gap: 12px }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px }
.mini { display: flex; align-items: center; gap: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--ink); text-decoration: none; font-weight: 600 }
.mini .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; flex: none }
.mini:hover { border-color: var(--accent) }

/* Ads: hidden unless switched on; then each slot keeps its size from the start. */
.ad { display: none }
html.ads-result .ad-result, html.ads-home .ad-home, html.ads-side .ad-side {
  display: grid; place-items: center; background: var(--ad); color: var(--ad-ink); border-radius: 10px; overflow: hidden; position: relative; margin-inline: auto }
.ad > span { position: absolute; top: 4px; left: 8px; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase }
html.ads-result .ad-result { width: min(100%, 336px); height: 280px }
html.ads-home .ad-home { width: min(100%, 728px); height: 90px }
html.ads-side .ad-side { width: 160px; height: 600px }
@media (max-width: 760px) { html.ads-home .ad-home { width: min(100%, 320px); height: 100px } }
.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--paper); border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px -16px rgba(0, 0, 0, .4); padding: 14px max(16px, env(safe-area-inset-left)) calc(14px + env(safe-area-inset-bottom)) }
.consent-in { max-width: 1080px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; justify-content: space-between }
.consent p { margin: 0; font-size: .92rem; max-width: 70ch }
.consent .row { flex: 0 0 auto }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 30 }
