/* Közös felületi elemek (design.md 2-4): összeg, csempék, kategóriaválasztó lap, toast, jelvény.
   Csak a tokenekből (tokens.css) dolgozik; nincs inline stílus, nincs külső erőforrás. */

[hidden] {
  display: none !important;
}

/* ---------- összeg ---------- */
.money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.money--in {
  color: var(--income);
}

/* ---------- navigációs jelvény ---------- */
.nav-item {
  position: relative;
}
.nav-badge {
  position: absolute;
  top: 4px;
  left: 50%;
  margin-left: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---------- csempék ---------- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-1);
  min-height: 72px;
  padding: var(--space-2) var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}
.tile .icon {
  width: 24px;
  height: 24px;
  flex: none;
}
.tile-label {
  max-width: 100%;
  overflow-wrap: break-word; /* a törzs `anywhere`-je félbetörné a „Közlekedés”-t */
  hyphens: manual;
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile:hover {
  border-color: var(--accent);
}
.tile[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- alulról felcsúszó lap (az egyetlen elem, amely árnyékot kap) ---------- */
body.sheet-open {
  overflow: hidden;
}
.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.4);
  opacity: 0;
  transition: opacity 200ms ease-out;
}
.sheet.is-open .sheet-backdrop {
  opacity: 1;
}
.sheet-panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-2) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  box-shadow: 0 -8px 32px rgb(0 0 0 / 0.18);
  transform: translate(-50%, 100%);
  transition: transform 200ms ease-out;
  outline: none;
}
.sheet.is-open .sheet-panel {
  transform: translate(-50%, 0);
}
.sheet-grip {
  width: 36px;
  height: 4px;
  margin: 0 auto var(--space-3);
  border-radius: 2px;
  background: var(--border);
}
.sheet-search {
  margin-bottom: var(--space-3);
}
.sheet-label {
  margin: var(--space-3) 0 var(--space-2);
  color: var(--text-2);
  font-size: 13px;
}
.sheet-empty {
  padding: var(--space-4) 0;
  text-align: center;
}

/* ---------- toast ---------- */
.toast-region {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + var(--space-3));
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 560px;
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-btn);
  background: var(--text);
  color: var(--bg);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}
.toast.is-in {
  opacity: 1;
  transform: none;
}
.toast-text {
  flex: 1;
  font-size: 14px;
}
.toast-action {
  min-height: var(--tap);
  padding: 0 var(--space-2);
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- általános segédek ---------- */
.tnum {
  font-variant-numeric: tabular-nums;
}
.is-loading {
  cursor: progress;
}
/* fő művelet gomb: a billentyűzet/navigáció fölött marad (design.md 3.4) */
.sticky-action {
  position: sticky;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + var(--space-3));
  padding-top: var(--space-3);
}

@media (prefers-reduced-motion: reduce) {
  .tile,
  .sheet-backdrop,
  .sheet-panel,
  .toast {
    transition: none;
  }
}
