/* =====================================================================
   Belegportal — felület. Rendszerbetűk (nincs Google Fonts / külső betöltés — DSGVO).
   Tokenek világos és sötét témára; minden szín innen jön.
   ===================================================================== */
:root {
  --bg: #f6f5f1; --flaeche: #ffffff; --flaeche-2: #efede6; --linie: #dcd8cc; --linie-stark: #bdb7a6;
  --text: #1d211f; --text-2: #565c57; --text-3: #7d827c;
  --akzent: #1f5f4a; --akzent-hover: #174a3a; --akzent-text: #ffffff; --akzent-weich: #e2eee8;
  --gelb: #8a5a00; --gelb-bg: #fbf0d6; --blau: #1d4f86; --blau-bg: #e3edf8; --rot: #a3261d; --rot-bg: #f9e4e1;
  --gruen: #1d6b3c; --gruen-bg: #dff1e5; --grau-bg: #ecebe6;
  --fokus: #e8b33a; --schatten: 0 1px 2px rgba(30, 35, 30, .06), 0 4px 16px rgba(30, 35, 30, .06);
  --radius: 10px; --radius-s: 6px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141716; --flaeche: #1c201e; --flaeche-2: #242927; --linie: #323936; --linie-stark: #4a524e;
    --text: #e8ebe8; --text-2: #aab2ad; --text-3: #848c87;
    --akzent: #5fb894; --akzent-hover: #78c9a7; --akzent-text: #0e1a15; --akzent-weich: #1d3329;
    --gelb: #f0c464; --gelb-bg: #3a2f14; --blau: #8fb8ea; --blau-bg: #1a2a3d; --rot: #f09a90; --rot-bg: #3d1e1a;
    --gruen: #8fd6a8; --gruen-bg: #183324; --grau-bg: #2a2f2c;
    --schatten: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
[hidden] { display: none !important; }
a { color: var(--akzent); }
h1, h2, h3 { line-height: 1.25; text-wrap: balance; margin: 0; }
h1 { font-size: 1.5rem; font-weight: 650; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--flaeche); padding: 8px 12px; }

/* ---------- fejléc ---------- */
.kopf { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.marke { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; }
.marke-zeichen { width: 22px; height: 22px; border-radius: 5px; background: var(--akzent); position: relative; }
.marke-zeichen::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--fokus); }
.test-chip { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--gelb-bg); color: var(--gelb); padding: 1px 6px; border-radius: 4px; }
nav.haupt { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; min-width: 0; }
nav.haupt a { padding: 6px 10px; border-radius: var(--radius-s); color: var(--text-2); text-decoration: none; font-weight: 500; white-space: nowrap; }
nav.haupt a:hover { background: var(--flaeche-2); color: var(--text); }
nav.haupt a.aktiv { background: var(--akzent-weich); color: var(--akzent); }
nav.haupt .badge { margin-left: 6px; }
.kopf-rechts { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.kontext { max-width: 260px; }

main { max-width: 1280px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-right)) 64px max(16px, env(safe-area-inset-left)); outline: none; }
.laden, .leer { color: var(--text-3); padding: 32px 0; text-align: center; }

/* ---------- elrendezés ---------- */
.stapel { display: flex; flex-direction: column; gap: 16px; }
.stapel-s { display: flex; flex-direction: column; gap: 8px; }
.zeile { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.zeile.ende { justify-content: flex-end; }
.zeile.zwischen { justify-content: space-between; }
.spacer { flex: 1; }
.raster { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.seitenkopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.seitenkopf .unter { color: var(--text-2); margin-top: 4px; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 18px; box-shadow: var(--schatten); min-width: 0; }
.karte > h2, .karte > h3 { margin-bottom: 12px; }
.hinweis { font-size: .88rem; color: var(--text-2); }
.klein { font-size: .82rem; color: var(--text-3); }
.mono { font-family: var(--mono); font-size: .9em; }
.zahl { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.kennzahl { display: flex; flex-direction: column; gap: 2px; }
.kennzahl b { font-size: 1.8rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.kennzahl span { color: var(--text-2); font-size: .85rem; }

/* ---------- űrlap ---------- */
label.feld { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 600; color: var(--text-2); min-width: 0; }
label.feld > span.opt { font-weight: 400; color: var(--text-3); }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--linie-stark); border-radius: var(--radius-s); background: var(--flaeche); color: var(--text); min-width: 0; }
input:disabled, select:disabled, textarea:disabled { background: var(--flaeche-2); color: var(--text-3); }
input.fehlt { border-color: var(--rot); background: var(--rot-bg); }
textarea { min-height: 70px; resize: vertical; }
.formraster { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.formraster .breit { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; }
.check input { margin-top: 3px; }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-s);
  border: 1px solid var(--linie-stark); background: var(--flaeche); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
button:hover, .btn:hover { background: var(--flaeche-2); }
button.primaer, .btn.primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
button.primaer:hover { background: var(--akzent-hover); }
button.gefahr { color: var(--rot); border-color: var(--rot); background: transparent; }
button.gefahr:hover { background: var(--rot-bg); }
button.link { border: 0; background: none; padding: 4px 6px; color: var(--akzent); font-weight: 500; }
button.klein, .btn.klein { padding: 4px 9px; font-size: .84rem; }
button:disabled { opacity: .55; cursor: progress; }
kbd { font-family: var(--mono); font-size: .75rem; border: 1px solid var(--linie-stark); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }

/* ---------- chip / jelvény ---------- */
.chip { display: inline-block; font-size: .76rem; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--grau-bg); color: var(--text-2); }
.chip.gelb { background: var(--gelb-bg); color: var(--gelb); }
.chip.blau { background: var(--blau-bg); color: var(--blau); }
.chip.gruen { background: var(--gruen-bg); color: var(--gruen); }
.chip.gruen-voll { background: var(--gruen); color: var(--flaeche); }
.chip.rot { background: var(--rot-bg); color: var(--rot); }
.badge { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; background: var(--gelb-bg); color: var(--gelb); }

/* ---------- táblázat ---------- */
.tabelle-huelle { overflow-x: auto; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; font-size: .74rem; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--linie); background: var(--flaeche-2); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--linie); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.klickbar { cursor: pointer; }
tr.klickbar:hover td { background: var(--flaeche-2); }
td.aktionen { text-align: right; white-space: nowrap; }

/* ---------- fülek ---------- */
.reiter { display: flex; gap: 4px; border-bottom: 1px solid var(--linie); margin-bottom: 20px; overflow-x: auto; }
.reiter a { padding: 9px 14px; color: var(--text-2); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.reiter a.aktiv { color: var(--akzent); border-bottom-color: var(--akzent); }

/* ---------- feltöltés ---------- */
.ablage { border: 2px dashed var(--linie-stark); border-radius: var(--radius); padding: 28px 18px; text-align: center; background: var(--flaeche); transition: background .15s, border-color .15s; }
.ablage.ueber { border-color: var(--akzent); background: var(--akzent-weich); }
.ablage h2 { margin-bottom: 6px; }
.ablage .zeile { justify-content: center; margin-top: 14px; }
.richtung-wahl { display: inline-flex; border: 1px solid var(--linie-stark); border-radius: var(--radius-s); overflow: hidden; flex-wrap: wrap; }
.richtung-wahl label { padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--text-2); border-right: 1px solid var(--linie); }
.richtung-wahl label:last-child { border-right: 0; }
.richtung-wahl input { position: absolute; opacity: 0; pointer-events: none; }
.richtung-wahl label:has(input:checked) { background: var(--akzent); color: var(--akzent-text); }
.richtung-wahl label:has(input:focus-visible) { outline: 3px solid var(--fokus); outline-offset: -3px; }
.fortschritt { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.fortschritt li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; background: var(--flaeche-2); border-radius: var(--radius-s); font-size: .88rem; }
.fortschritt li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fotos { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.fotos img { width: 72px; height: 96px; object-fit: cover; border-radius: 4px; border: 1px solid var(--linie); }
.adresse { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--flaeche-2); padding: 8px 12px; border-radius: var(--radius-s); }
.adresse code { font-family: var(--mono); font-size: .88rem; word-break: break-all; }

/* ---------- ellenőrző képernyő ---------- */
.pruefen { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 960px) { .pruefen { grid-template-columns: 1fr; } }
.vorschau { position: sticky; top: 70px; height: calc(100vh - 100px); min-height: 420px; background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; display: flex; }
@media (max-width: 960px) { .vorschau { position: static; height: 60vh; } }
.vorschau iframe, .vorschau object { flex: 1; border: 0; width: 100%; height: 100%; background: #fff; }
.vorschau .bild { flex: 1; overflow: auto; display: flex; align-items: flex-start; justify-content: center; }
.vorschau .bild img { max-width: 100%; }
.vorschau pre { margin: 0; padding: 14px; overflow: auto; font-size: .78rem; flex: 1; white-space: pre-wrap; word-break: break-word; }
.hinweise { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hinweise li { padding: 8px 10px; border-radius: var(--radius-s); font-size: .88rem; border-left: 3px solid; }
.hinweise li.fehler { background: var(--rot-bg); border-color: var(--rot); }
.hinweise li.warnung { background: var(--gelb-bg); border-color: var(--gelb); }
.hinweise li.info { background: var(--blau-bg); border-color: var(--blau); }
.vorschlaege { display: flex; flex-wrap: wrap; gap: 8px; }
.vorschlag { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 11px; text-align: left; white-space: normal; max-width: 100%; }
.vorschlag b { font-family: var(--mono); font-size: .95rem; }
.vorschlag span { font-size: .78rem; color: var(--text-2); font-weight: 500; }
.vorschlag.gewaehlt { border-color: var(--akzent); background: var(--akzent-weich); }
.vorschlag.warn span { color: var(--gelb); }
.zeilen td { padding: 6px; }
.zeilen input, .zeilen select { padding: 6px 7px; }
.zeilen .konto { width: 92px; font-family: var(--mono); }
.zeilen .bu { width: 58px; font-family: var(--mono); }
.zeilen .satz { width: 74px; }
.zeilen .betrag { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.zeilen .kost { width: 80px; }
.zeilen .bez { font-size: .76rem; color: var(--text-3); display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summe { padding: 8px 12px; border-radius: var(--radius-s); font-weight: 600; font-size: .9rem; }
.summe.ok { background: var(--gruen-bg); color: var(--gruen); }
.summe.nok { background: var(--rot-bg); color: var(--rot); }
.aktionsleiste { position: sticky; bottom: 0; background: var(--flaeche); border-top: 1px solid var(--linie); margin: 0 -18px -18px; padding: 12px 18px; border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- export ---------- */
.meldungen { margin: 0; padding-left: 18px; font-size: .88rem; max-height: 260px; overflow: auto; }
.meldungen.fehler li { color: var(--rot); }
.balken { height: 8px; border-radius: 4px; background: var(--flaeche-2); overflow: hidden; }
.balken > i { display: block; height: 100%; background: var(--akzent); width: 0; transition: width .2s; }
.stufe { display: inline-flex; gap: 3px; }
.stufe i { width: 14px; height: 6px; border-radius: 2px; background: var(--linie); }
.stufe i.an { background: var(--akzent); }

/* ---------- belépés ---------- */
.anmeldung { max-width: 400px; margin: 8vh auto 0; }
.anmeldung .marke { justify-content: center; font-size: 1.2rem; margin-bottom: 20px; }

/* ---------- értesítés ---------- */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 50; max-width: min(560px, calc(100vw - 32px));
  padding: 11px 16px; border-radius: var(--radius); background: var(--text); color: var(--bg); box-shadow: var(--schatten); font-weight: 500; }
.toast.fehler { background: var(--rot); color: #fff; }
.toast.ok { background: var(--akzent); color: var(--akzent-text); }

dialog { border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); color: var(--text); padding: 20px; max-width: min(520px, calc(100vw - 32px)); box-shadow: var(--schatten); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }

@media (max-width: 640px) {
  main { padding-top: 16px; }
  h1 { font-size: 1.3rem; }
  .kopf { gap: 8px; }
  .kontext { max-width: 160px; }
  td, th { padding: 8px; }
  .nur-breit { display: none; }
}
@media print { .kopf, .aktionsleiste, button { display: none !important; } }
.zeilen .bez.warn { color: var(--gelb); }
main:focus, main:focus-visible { outline: none; }
.zeile > select, .zeile > input[type=month], .zeile > input[type=email], .zeile > input[type=date] { width: auto; }
.zeile > input[type=search], .zeile > input[type=email] { flex: 1 1 220px; max-width: 420px; }
.formraster.weit { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.zeile:has(> label.feld) { align-items: flex-end; }
