/* ============ Házipénztár — design tokenek ============
   Paletta: pénztárkönyv-zöld tinta + papír
   ink:    #13201A   paper: #F4F3EE   card: #FFFFFF
   green:  #1E9E5A (bevétel/jóváírás)
   red:    #D2504A (kiadás/terhelés)
   Betűk:  Space Grotesk (címek/UI) + IBM Plex Mono (összegek)
======================================================== */
:root {
  --ink: #13201A;
  --ink-2: #2A3B32;
  --muted: #6E7B72;
  --paper: #F4F3EE;
  --card: #FFFFFF;
  --line: #E4E2D9;
  --green: #1E9E5A;
  --green-bg: #E7F5EC;
  --red: #D2504A;
  --red-bg: #FBEAE8;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(19,32,26,.06), 0 6px 20px rgba(19,32,26,.06);
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
body.dark { background: var(--ink); color: #EDF2EE; }

button { font-family: inherit; }
a { color: inherit; }
h1,h2,h3 { margin: 0; }
small { color: var(--muted); }

/* ============ Fejléc + tartalom + tab bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 12px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.topbar-user { font-size: 13px; color: var(--muted); font-weight: 600; }
.linkbtn { background: none; border: 0; color: var(--muted); font-weight: 600; font-size: 14px; padding: 6px; cursor: pointer; }

.content {
  max-width: 560px; margin: 0 auto;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 96px);
}
.hello { margin: 2px 4px 12px; font-weight: 600; color: var(--ink-2); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(env(safe-area-inset-bottom) + 8px);
}
.tabbar a {
  flex: 1; max-width: 140px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px; border-radius: 12px;
  text-decoration: none; font-size: 11.5px; font-weight: 600; color: var(--muted);
}
.tabbar svg { width: 23px; height: 23px; fill: currentColor; }
.tabbar a.on { color: var(--ink); background: var(--paper); }

/* ============ Pénz-kijelző kártya (signature elem) ============ */
.cash-card {
  background: linear-gradient(160deg, #17261E 0%, #0F1A14 100%);
  color: #EDF6EF;
  border-radius: var(--radius);
  padding: 24px 20px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.cash-card::after { /* finom „kijelző” csík */
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.015) 3px 4px);
  pointer-events: none;
}
.cash-label { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #9DBBA7; }
.cash-amount {
  font-family: var(--mono);
  font-size: clamp(34px, 9vw, 44px);
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 8px 0 4px;
  font-variant-numeric: tabular-nums;
}
.cash-sub { font-size: 13px; color: #9DBBA7; }
.cash-card.cc-neg .cash-amount { color: #FFB4AE; }
.cash-card.cc-pos .cash-amount { color: #93E5B4; }
.cash-actions { display: flex; gap: 10px; margin-top: 18px; position: relative; z-index: 1; }
.pad-h { margin: 0 0 18px; }

/* ============ Gombok ============ */
.btn {
  flex: 1;
  border: 0; border-radius: 14px;
  padding: 14px 16px;
  font-size: 15.5px; font-weight: 700;
  cursor: pointer;
  transition: transform .06s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-in  { background: var(--green); color: #fff; }
.btn-out { background: var(--red); color: #fff; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--line); }
.btn-block { width: 100%; margin-top: 6px; }

.fab {
  position: fixed; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 86px); z-index: 25;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--ink); color: #fff;
  border: 0; font-size: 26px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(19,32,26,.28);
}
.fab:active { transform: scale(.95); }

/* ============ Listák ============ */
.list-section { margin-top: 6px; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 10px; }
.list-head h2 { font-size: 15px; font-weight: 700; color: var(--ink-2); }
.link { font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none; }

.tx-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tx {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border-radius: 14px;
  padding: 12px 14px;
  border-left: 5px solid transparent;
  box-shadow: 0 1px 2px rgba(19,32,26,.05);
}
.tx-in  { border-left-color: var(--green); }
.tx-out { border-left-color: var(--red); }
.tx-main { flex: 1; min-width: 0; }
.tx-note { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tx-amount {
  font-family: var(--mono);
  font-weight: 600; font-size: 15.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tx-in  .tx-amount { color: var(--green); }
.tx-out .tx-amount { color: var(--red); }
.tx-del button {
  border: 0; background: var(--paper); color: var(--muted);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 13px;
}
.tx-del button:active { background: var(--red-bg); color: var(--red); }

.empty {
  background: var(--card); border: 1.5px dashed var(--line);
  border-radius: var(--radius); padding: 28px 18px;
  text-align: center; color: var(--muted); font-size: 14px;
}

/* ============ Statisztika sor + szegmens ============ */
.stat-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.stat {
  background: var(--card); border-radius: 14px; padding: 12px 10px;
  display: flex; flex-direction: column; gap: 3px;
  box-shadow: 0 1px 2px rgba(19,32,26,.05);
}
.stat span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat b { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; }
.stat.s-in b { color: var(--green); }
.stat.s-out b { color: var(--red); }

.seg {
  display: flex; background: #E9E7DE; border-radius: 12px; padding: 4px; margin-bottom: 14px;
}
.seg a {
  flex: 1; text-align: center; padding: 8px 4px;
  border-radius: 9px; text-decoration: none;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
}
.seg a.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(19,32,26,.1); }

/* ============ Ügyfél kártyák ============ */
.client-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.client-card {
  display: flex; align-items: center; gap: 13px;
  background: var(--card); border-radius: var(--radius);
  padding: 14px; text-decoration: none;
  box-shadow: 0 1px 2px rgba(19,32,26,.05);
}
.client-card:not(.static):active { background: #FBFAF6; }
.client-card.inactive { opacity: .55; }
.client-avatar {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--ink); color: #EDF6EF;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; flex-shrink: 0;
}
.client-main { flex: 1; min-width: 0; }
.client-name { font-weight: 700; font-size: 15.5px; }
.client-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.client-balance { text-align: right; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.client-balance b {
  display: block; font-family: var(--mono);
  font-size: 15px; font-variant-numeric: tabular-nums;
  margin-top: 2px; text-transform: none; letter-spacing: 0;
  color: var(--ink);
}
.client-balance.neg b { color: var(--red); }
.client-balance.pos b { color: var(--green); }
.user-actions { display: flex; gap: 6px; align-items: center; }
.chip {
  border: 1.5px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 7px 12px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.chip:active { background: var(--paper); }

/* ============ Kártyák, mezők ============ */
.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(19,32,26,.05); margin-bottom: 12px; }
.card.pad { padding: 16px; }
.card-title { font-size: 15px; margin-bottom: 12px; }
.me-row { display: flex; align-items: center; gap: 13px; }
.row-link { display: flex; justify-content: space-between; align-items: center; text-decoration: none; font-weight: 600; font-size: 14.5px; }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--paper); color: var(--ink);
  padding: 13px 14px; font-size: 16px; font-family: inherit;
  appearance: none; -webkit-appearance: none;
}
.field input:focus, .field select:focus { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
.amount-wrap { position: relative; }
.amount-wrap input { font-family: var(--mono); font-weight: 600; font-size: 20px; padding-right: 46px; font-variant-numeric: tabular-nums; }
.amount-wrap b { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 4px 2px 14px; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--green); }
.hint { font-size: 12.5px; color: var(--muted); margin: -6px 0 12px; }

/* ============ Alsó lapok (sheet) ============ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(15,22,18,.45);
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
}
.sheet-backdrop.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(env(safe-area-inset-bottom) + 18px);
  transform: translateY(105%);
  transition: transform .28s cubic-bezier(.32,.72,.28,1);
  max-width: 560px; margin: 0 auto;
  box-shadow: 0 -8px 40px rgba(19,32,26,.18);
}
.sheet.show { transform: translateY(0); }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 14px; }
.sheet-title { font-size: 17px; margin-bottom: 16px; }
.sheet-title.t-in { color: var(--green); }
.sheet-title.t-out { color: var(--red); }

/* ============ Jelmagyarázat (ügyfél portál) ============ */
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 2px 16px; }
.lg { font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: 999px; }
.lg-in  { background: var(--green-bg); color: #14713F; }
.lg-out { background: var(--red-bg); color: #A93832; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 16px; right: 16px; z-index: 60;
  top: calc(env(safe-area-inset-top) + 14px);
  max-width: 480px; margin: 0 auto;
  padding: 13px 16px; border-radius: 14px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(19,32,26,.22);
  animation: toastIn .3s ease;
}
.toast-ok  { background: var(--ink); color: #DFF3E6; }
.toast-err { background: var(--red); color: #fff; }
@keyframes toastIn { from { transform: translateY(-16px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.hide { transition: opacity .3s, transform .3s; opacity: 0; transform: translateY(-16px); }

/* ============ PIN képernyő ============ */
.pin-screen {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px;
  padding: calc(env(safe-area-inset-top) + 24px) 24px calc(env(safe-area-inset-bottom) + 30px);
  background:
    radial-gradient(120% 90% at 50% -10%, #1C2F24 0%, transparent 60%),
    var(--ink);
}
.pin-brand { text-align: center; }
.pin-logo {
  width: 62px; height: 62px; margin: 0 auto 14px;
  border-radius: 20px;
  background: #EDF6EF; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 600; font-size: 24px;
}
.pin-brand h1 { font-size: 22px; letter-spacing: -.01em; }
.pin-sub { margin: 6px 0 0; color: #9DBBA7; font-size: 14px; }

.pin-dots { display: flex; gap: 14px; justify-content: center; margin-bottom: 26px; }
.pin-dots span {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #46604F;
  transition: background .12s, border-color .12s, transform .12s;
}
.pin-dots span.fill { background: #EDF6EF; border-color: #EDF6EF; transform: scale(1.08); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-8px);} 40%,80% { transform: translateX(8px);} }

.pin-pad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  width: min(310px, 78vw);
}
.pin-pad button {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,.07);
  color: #EDF6EF;
  font-size: 26px; font-weight: 600; font-family: var(--sans);
  cursor: pointer;
  transition: background .12s, transform .08s;
  -webkit-user-select: none; user-select: none;
}
.pin-pad button:active { background: rgba(255,255,255,.18); transform: scale(.94); }
.pin-pad .pin-fn { font-size: 19px; background: transparent; }
.pin-pad .pin-ok { background: var(--green); font-size: 17px; font-weight: 700; }
.pin-pad .pin-ok:active { background: #17824A; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============ Megjegyzés szerkesztő gomb ============ */
.tx-edit {
  border: 0; background: var(--paper); color: var(--muted);
  width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; font-size: 13px; flex-shrink: 0;
}
.tx-edit:active { background: var(--line); color: var(--ink); }
