:root {
  --navy: #1f3864;
  --navy2: #2e5597;
  --bg: #f2f4f8;
  --card: #fff;
  --ink: #1a1d24;
  --muted: #667085;
  --line: #e1e5ec;
  --green: #1e7f4f;
  --amber: #b45309;
  --red: #b42318;
  --violet: #5b3cc4;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--navy2); }

/* Fejléc */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  background: var(--navy); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  min-height: 56px;
}
.top h1 { flex: 1; font-size: 18px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back { color: #fff; text-decoration: none; font-size: 34px; line-height: 1; padding: 0 10px 4px 0; }
.top .logo { font-weight: 800; background: #fff; color: var(--navy); border-radius: 8px; padding: 3px 7px; font-size: 14px; }
.top .who {
  width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.18);
  color: #fff; display: grid; place-items: center; text-decoration: none; font-weight: 700;
}

main { max-width: 680px; margin: 0 auto; padding: 14px; }

/* Alsó menü */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; text-decoration: none; color: var(--muted);
  font-size: 12px; padding: 8px 2px 10px; font-weight: 600;
}
.tabbar a span { display: block; font-size: 22px; line-height: 1.2; }
.tabbar a.on { color: var(--navy); }

/* Kártyák */
.card {
  background: var(--card); border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.06);
}
.card h2 { font-size: 17px; margin: 0 0 8px; }
.sect { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 20px 4px 8px; font-weight: 700; display: flex; justify-content: space-between; }
.sect .n { background: var(--navy); color: #fff; border-radius: 10px; padding: 0 8px; letter-spacing: 0; }
.empty { color: var(--muted); text-align: center; padding: 18px; }

a.item {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(16,24,40,.06); border-left: 5px solid var(--line);
}
a.item:active { background: #eef2f8; }
.item .row1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.item .rsz { font-weight: 800; font-size: 17px; letter-spacing: .02em; }
.item .meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.item .title { font-weight: 600; margin-top: 4px; }
.item.s-folyamatban { border-left-color: var(--green); }
.item.s-szunetel { border-left-color: var(--amber); }
.item.s-ellenorzes { border-left-color: var(--violet); }
.item.s-visszakuldve { border-left-color: var(--red); }
.item.s-elfogadva { border-left-color: #98a2b3; }
.item.s-kiosztva { border-left-color: var(--navy2); }

/* Állapot-címkék */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.b-kiosztva { background: #e4ecfa; color: var(--navy2); }
.b-folyamatban { background: #dcf3e6; color: var(--green); }
.b-szunetel { background: #fdf0d9; color: var(--amber); }
.b-ellenorzes { background: #ebe5fb; color: var(--violet); }
.b-elfogadva { background: #eaecf0; color: #475467; }
.b-visszakuldve { background: #fde4e1; color: var(--red); }
.m-nyitott { background: #e4ecfa; color: var(--navy2); }
.m-kesz { background: #dcf3e6; color: var(--green); }
.m-lezarva { background: #eaecf0; color: #475467; }

/* Adatlista */
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 14px; }
dl.kv dd { margin: 0; font-weight: 600; }
.desc { white-space: pre-wrap; margin: 8px 0 0; }
.note { background: #fff8e6; border-radius: 10px; padding: 8px 12px; margin-top: 10px; font-size: 15px; }
.note.red { background: #fdecea; }

/* Űrlapok */
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 5px; }
label .opt { color: var(--muted); font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=email], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 17px; padding: 12px; border: 1px solid #cdd3dd;
  border-radius: 10px; background: #fff; color: var(--ink); appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, #667085 50%), linear-gradient(135deg, #667085 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 34px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid #c7d7f5; border-color: var(--navy2); }
.upper { text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.err { color: var(--red); font-size: 14px; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chips label { margin: 0; font-weight: 500; }
.chips input { position: absolute; opacity: 0; }
.chips span { display: inline-block; padding: 9px 14px; border: 1px solid #cdd3dd; border-radius: 20px; background: #fff; font-size: 15px; }
.chips input:checked + span { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Gombok */
.btn, button {
  display: block; width: 100%; text-align: center; font: inherit; font-weight: 700; font-size: 17px;
  padding: 14px; border-radius: 12px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--navy); color: #fff; margin-top: 12px; touch-action: manipulation;
}
.btn.sec, button.sec { background: #e4e9f2; color: var(--navy); }
.btn.green, button.green { background: var(--green); }
.btn.amber, button.amber { background: var(--amber); }
.btn.red, button.red { background: var(--red); }
.btn.violet, button.violet { background: var(--violet); }
.btn.big, button.big { font-size: 20px; padding: 20px; }
button:disabled { opacity: .55; }
button.busy::after { content: " …"; }
.btnrow { display: flex; gap: 10px; }
.btnrow > * { flex: 1; }

/* Lenyíló rész (felugró ablak helyett) */
details.fold { background: var(--card); border-radius: var(--radius); margin-bottom: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.06); }
details.fold > summary {
  list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 700; display: flex; justify-content: space-between;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "▾"; color: var(--muted); }
details.fold[open] > summary::after { content: "▴"; }
details.fold > div { padding: 0 16px 16px; }
details.action > summary { background: var(--amber); color: #fff; border-radius: 12px; justify-content: center; font-size: 17px; padding: 14px; }
details.action.red > summary { background: var(--red); }
details.action > summary::after { content: ""; }
details.action[open] > summary { border-radius: 12px 12px 0 0; }
details.action { margin-top: 12px; }

/* Napló, megjegyzések */
ul.log { list-style: none; margin: 0; padding: 0; }
ul.log li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
ul.log li:first-child { border-top: 0; }
ul.log .when { color: var(--muted); font-size: 13px; }

.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-weight: 600; }
.flash.ok { background: #dcf3e6; color: #0f5132; }
.flash.err { background: #fde4e1; color: var(--red); }
.flash.info { background: #e4ecfa; color: var(--navy); }

.timer { font-size: 28px; font-weight: 800; color: var(--green); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs a { flex: 1; text-align: center; padding: 9px; border-radius: 10px; background: #e4e9f2; color: var(--navy); text-decoration: none; font-weight: 700; font-size: 14px; }
.tabs a.on { background: var(--navy); color: #fff; }
.search { display: flex; gap: 8px; margin-bottom: 10px; }
.search button { width: auto; margin: 0; padding: 0 18px; }

.login { max-width: 380px; margin: 8vh auto 0; }
.login .brand { text-align: center; margin-bottom: 18px; }
.login .brand b { display: inline-block; background: var(--navy); color: #fff; border-radius: 14px; padding: 10px 14px; font-size: 26px; }
.login .brand div { margin-top: 8px; color: var(--muted); }

@media (min-width: 700px) {
  main { padding: 20px; }
}

/* Alkatrészek */
ul.parts li { padding: 10px 0; }
.prow { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.pname { font-weight: 600; font-size: 15px; }
.pqty { font-weight: 800; white-space: nowrap; color: var(--navy); }
a.plink { display: block; color: inherit; text-decoration: none; }
a.plink:active { background: #eef2f8; }
.admin-box { border: 2px dashed #c9b6f2; }
.admin-box > summary { color: var(--violet); }

/* Fotók */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.photos a { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #e4e9f2; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.filebtn { cursor: pointer; margin-top: 0; font-size: 15px; }
.upstat { margin-top: 8px; text-align: center; }

/* Értesítés */
.toast { position: fixed; left: 12px; right: 12px; top: calc(66px + env(safe-area-inset-top)); z-index: 50;
  background: var(--violet); color: #fff; padding: 14px 16px; border-radius: 12px; font-weight: 700;
  text-decoration: none; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.tabbar a { position: relative; }
.nbadge { position: absolute; top: 2px; left: 50%; margin-left: 8px; background: var(--red); color: #fff;
  border-radius: 10px; font-size: 11px; padding: 1px 6px; font-weight: 800; }

/* Költség */
table.cost { width: 100%; border-collapse: collapse; font-size: 15px; }
table.cost td { padding: 6px 0; border-top: 1px solid var(--line); vertical-align: top; }
table.cost td.r { text-align: right; white-space: nowrap; padding-left: 10px; font-weight: 600; }
table.cost tr.sum td { font-weight: 800; font-size: 17px; border-top: 2px solid var(--ink); }
table.cost tr:first-child td { border-top: 0; }
.mirow { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.mirow:first-of-type { border-top: 0; }
.mirow label { margin-top: 6px; }
input[type=datetime-local] { width: 100%; font: inherit; font-size: 15px; padding: 10px; border: 1px solid #cdd3dd; border-radius: 10px; background: #fff; }

/* Szerelői kártya – rendszám a teljes szélességben */
a.mcard { display: block; text-decoration: none; color: inherit; background: var(--card); border-radius: var(--radius);
  margin-bottom: 10px; box-shadow: 0 1px 3px rgba(16,24,40,.10); overflow: hidden; border: 2px solid var(--line); }
a.mcard:active { transform: scale(.99); }
.mplate { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 14px; background: #eef2f8; border-bottom: 1px solid var(--line); }
.mrsz { font-size: 30px; font-weight: 900; letter-spacing: .06em; line-height: 1.1; color: var(--ink); }
.mplate .timer { font-size: 20px; }
.mbody { padding: 10px 14px 12px; }
.mtitle { font-size: 18px; font-weight: 700; }
a.mcard.s-folyamatban { border-color: var(--green); }
a.mcard.s-folyamatban .mplate { background: #dcf3e6; }
a.mcard.s-szunetel { border-color: #f3c27a; }
a.mcard.s-szunetel .mplate { background: #fdf0d9; }
a.mcard.s-visszakuldve { border-color: #f1a49c; }
a.mcard.s-visszakuldve .mplate { background: #fde4e1; }
a.mcard.s-ellenorzes { opacity: .75; }
a.mcard.s-ellenorzes .mplate { background: #ebe5fb; }

/* Matrica */
.matrica-elonezet { width: 100%; max-width: 420px; height: auto; border: 1px dashed #98a2b3; border-radius: 6px; image-rendering: pixelated; background: #fff; }
.qrlink { word-break: break-all; font-size: 13px; }
.kapcsolo { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 0; }
.kapcsolo input { width: auto; transform: scale(1.3); }

/* Főképernyős alkalmazásban (telefon) a böngészős nyomtatás nem működik */
.onallo .csak-bongeszo { display: none !important; }
a.foglalt { opacity: .6; pointer-events: none; }
.megoszt-panel { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; z-index: 100; }
.megoszt-panel > div { background: #fff; width: 100%; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; }
.megoszt-panel b { display: block; margin-bottom: 10px; word-break: break-all; }

/* ---------- v0.7: fotócímkék, fotómelléklet, forgalmi beolvasás ---------- */
.photos a { position: relative; }
.ptag { position: absolute; left: 4px; bottom: 4px; font-size: 11px; font-weight: 700; color: #fff; padding: 2px 6px; border-radius: 6px; background: rgba(31,56,100,.85); }
.ptag.t-atvetel { background: rgba(122,75,0,.88); }
.ptag.t-elotte { background: rgba(180,35,24,.88); }
.ptag.t-kozben { background: rgba(46,85,151,.88); }
.ptag.t-utana { background: rgba(30,127,79,.88); }
.kepcimke { margin: 0 0 8px; }
.kepcimke span { padding: 7px 12px; font-size: 14px; }
.gombal { display: block; font-size: 12px; font-weight: 500; opacity: .85; margin-top: 2px; }

.forgalmi { border: 2px dashed #b9c6dc; background: #f6f8fc; }
.forgalmi summary { font-weight: 700; }
.forgalmi .fotok2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.forgalmi .fotok2 label.btn { margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 92px; text-align: center; font-size: 14px; }
.forgalmi .fotok2 label.btn img { max-width: 100%; max-height: 70px; border-radius: 6px; margin-bottom: 4px; }
.forgalmi .fotok2 label.btn.kesz { border: 2px solid var(--green); }
.forgalmi .allapot { margin-top: 8px; font-size: 14px; }
.forgalmi .allapot.hiba { color: var(--red); font-weight: 600; }
input.ai-ok, select.ai-ok, textarea.ai-ok { background: #eefaf2; border-color: #4caf7a; }
input.ai-bizonytalan { background: #fff6d6; border-color: #d9a400; }
.ai-jel { font-size: 12px; margin-top: 3px; color: var(--green); }
.ai-jel.b { color: #8a6500; font-weight: 600; }
.ai-javaslat { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: #fff6d6; font-size: 14px; }
.ai-javaslat button { width: auto; margin: 6px 0 0; padding: 8px 12px; font-size: 14px; }

.btnrow.r2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btnrow.r2 > * { margin: 0; }
.grid2 > * { min-width: 0; }
input[type=date] { max-width: 100%; min-width: 0; }
