:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1a1d23;
  --muted: #5b6270;
  --border: #e2e5ea;
  --accent: #0f766e;
  --accent-soft: #e6f4f2;
  --warn-bg: #fff8e6;
  --warn-border: #f0d58a;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --card: #1a1f25;
    --text: #e8eaed;
    --muted: #9aa3ae;
    --border: #2c333c;
    --accent: #2dd4bf;
    --accent-soft: #15302d;
    --warn-bg: #2b2414;
    --warn-border: #6b5520;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: var(--accent); }

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

header.site .inner, main, footer.site .inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 16px;
}

header.site .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

header.site a.brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}

header.site nav a {
  margin-left: 16px;
  text-decoration: none;
  font-size: 0.95rem;
}

main { padding-top: 24px; padding-bottom: 48px; }

h1 { font-size: 1.75rem; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 1.25rem; margin: 32px 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.tools {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.tools a.card {
  display: block;
  text-decoration: none;
  color: var(--text);
  margin: 0;
}

.tools a.card:hover { border-color: var(--accent); }
.tools a.card strong { display: block; margin-bottom: 4px; }
.tools a.card span { color: var(--muted); font-size: 0.9rem; }
.tools .soon { opacity: 0.55; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

input[type="text"], input[type="number"], select {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label {
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  margin: 0;
}
.seg input { accent-color: var(--accent); }

.result { background: var(--accent-soft); border-color: var(--accent); }
.result .big { font-size: 1.9rem; font-weight: 700; }
.result .sub { color: var(--muted); }

button.share {
  margin-top: 12px;
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--card);
  color: var(--accent);
  cursor: pointer;
}
button.share:hover { background: var(--accent-soft); }

.tools-group { margin: 28px 0 10px; font-size: 1.05rem; }

/* Fülek (radio alapú, így a megosztható link is megőrzi) */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tabs label {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer; font-weight: 600; font-size: 0.95rem; background: var(--card);
}
.tabs input { position: absolute; opacity: 0; pointer-events: none; }
.tabs label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--card); }
.tabs label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tab-panel[hidden] { display: none; }

/* Vállalkozói kalkulátor */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --grid: #eceef1; }
@media (prefers-color-scheme: dark) {
  :root { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --grid: #2a3038; }
}
th.win, td.win { background: var(--accent-soft); }
td.na { color: var(--muted); font-size: 0.85em; }
.why { margin: 0; padding-left: 20px; }
.why li { margin: 4px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.88rem; color: var(--muted); margin: 4px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart-wrap .axis { fill: var(--muted); font-size: 11px; }
.chart-wrap .gridline { stroke: var(--grid); stroke-width: 1; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 0.82rem; box-shadow: 0 4px 14px rgba(0,0,0,.12);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.tooltip i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
details.form-detail { padding: 8px 0; }
details.form-detail table { margin-top: 6px; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--border); }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.total td { font-weight: 700; border-bottom: none; }

@media (max-width: 560px) {
  header.site .inner { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 4px; }
  header.site nav a { margin-left: 0; margin-right: 14px; font-size: 0.9rem; }
  table { font-size: 0.82rem; }
  th, td { padding: 6px 3px; }
  td.num, th.num { white-space: normal; }
}

.note {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.9rem;
}

details { border-bottom: 1px solid var(--border); padding: 12px 0; }
details summary { cursor: pointer; font-weight: 600; }

footer.site {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px 0;
}
