/* Kassza alap-stílus (design.md): mobile-first, rendszerbetű, 4 px-es rács, 1 px-es keretek.
   Nincs inline stílus és külső erőforrás (CSP: style-src 'self'). */

:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-card: 12px;
  --radius-btn: 10px;
  --tap: 44px;
  --nav-height: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  overflow-wrap: anywhere;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
}

h2 {
  font-size: 16px;
  font-weight: 600;
}

.muted {
  color: var(--text-2);
  font-size: 13px;
}

/* Összegek: oszlopba rendezhető számjegyek; a negatív szám valódi mínuszjellel (U+2212) jön. */
.num {
  font-variant-numeric: tabular-nums;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- elrendezés ---------- */

.shell {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--space-4);
  padding-top: calc(var(--space-4) + env(safe-area-inset-top));
  padding-bottom: calc(var(--nav-height) + var(--space-8) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--tap);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 22px;
  font-weight: 600;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-btn);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 22px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ---------- űrlapok és gombok ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* legalább 16 px, különben iOS-en ránagyít fókuszkor */
  transition: border-color 150ms ease-out;
}

.input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

.input-code {
  text-align: center;
  font-size: 24px;
  letter-spacing: 0.3em;
  font-variant-numeric: tabular-nums;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: var(--tap);
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 150ms ease-out,
    border-color 150ms ease-out,
    transform 150ms ease-out;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}

.btn-block {
  width: 100%;
}

.alert {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--danger);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

/* ---------- bejelentkezési oldalak ---------- */

.auth {
  max-width: 560px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
  padding-top: calc(var(--space-8) + env(safe-area-inset-top));
  padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.auth-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.auth-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* mobilon a fő gomb az alsó harmadban, hüvelykujjal elérhetően */
.auth-actions {
  margin-top: auto;
  padding-top: var(--space-6);
}

@media (min-width: 600px) {
  .auth {
    justify-content: center;
  }

  .auth-form {
    flex: 0 0 auto;
  }

  .auth-actions {
    margin-top: 0;
  }
}

/* ---------- alsó navigáció ---------- */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-inner {
  max-width: 560px;
  height: var(--nav-height);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--tap);
  min-width: var(--tap);
  color: var(--text-2);
  font-size: 12px;
  text-decoration: none;
  transition: color 150ms ease-out;
}

.nav-item[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.nav-item[aria-disabled="true"] {
  opacity: 0.5;
  cursor: default;
}

.nav-add {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-top: -20px;
  border-radius: 50%;
  border: 4px solid var(--surface);
  background: var(--accent);
  color: var(--on-accent);
}

.nav-add[aria-disabled="true"] {
  opacity: 0.5;
}

.icon {
  width: 24px;
  height: 24px;
  display: block;
}

/* ---------- mozgás ---------- */

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