/* ══════════════════════════════════════════════════════════════
   HandBack – dizájnrendszer
   Mobil-első, iOS standalone-barát, minimal stílus.
   ══════════════════════════════════════════════════════════════ */

/* ── Tokenek ─────────────────────────────────────────────────── */
:root {
  --bg:            #f5f6f8;
  --bg-elevated:   #ffffff;
  --surface:       #ffffff;
  --surface-2:     #fafbfc;
  --surface-3:     #f2f4f7;

  --text:          #0f1115;
  --text-2:        #4b5563;
  --text-3:        #8b93a1;

  --border:        #e6e8ec;
  --border-2:      #d6dae1;

  --primary:       #0f1115;
  --primary-ink:   #ffffff;
  --accent:        #2f6df6;
  --accent-soft:   #eef3ff;

  --out:           #4f46e5;   /* kiadás  */
  --out-soft:      #eef0fe;
  --in:            #047857;   /* visszavétel */
  --in-soft:       #e8f6f0;
  --warn:          #b45309;
  --warn-soft:     #fdf3e3;
  --danger:        #d32f2f;
  --danger-soft:   #fdeded;
  --ok:            #047857;
  --ok-soft:       #e8f6f0;

  --r-sm: 6px;
  --r:    8px;
  --r-lg: 10px;
  --r-xl: 12px;

  --shadow-1: 0 1px 2px rgba(16, 20, 28, .05);
  --shadow-2: 0 2px 10px rgba(16, 20, 28, .07);
  --shadow-3: 0 12px 34px rgba(16, 20, 28, .14);

  --field-h: 48px;
  --header-h: 56px;
  --tabbar-h: 60px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  /* A fejléc teljes magassága (biztonságos terület + keret).
     A JS a valós, mért értékre pontosítja betöltéskor és átméretezéskor. */
  --header-total: calc(var(--header-h) + var(--safe-t));

  /* Oldalszegély – a tartalom ennyire megy ki a képernyő széléig */
  --gutter-l: max(16px, var(--safe-l));
  --gutter-r: max(16px, var(--safe-r));

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0c0d10;
    --bg-elevated: #15171c;
    --surface:     #15171c;
    --surface-2:   #1b1e24;
    --surface-3:   #23262e;

    --text:        #f2f4f7;
    --text-2:      #aeb6c2;
    --text-3:      #7c8494;

    --border:      #262a32;
    --border-2:    #343945;

    --primary:     #f2f4f7;
    --primary-ink: #0c0d10;
    --accent:      #6b9bff;
    --accent-soft: #16213a;

    --out:         #8b8bfa;
    --out-soft:    #1c1d33;
    --in:          #34c79a;
    --in-soft:     #10281f;
    --warn:        #e0a355;
    --warn-soft:   #2a2014;
    --danger:      #f07171;
    --danger-soft: #2c1717;
    --ok:          #34c79a;
    --ok-soft:     #10281f;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 2px 10px rgba(0, 0, 0, .45);
    --shadow-3: 0 12px 34px rgba(0, 0, 0, .6);

    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  text-rendering: optimizeLegibility;
}

/* Teljes képernyős (telepített) módban ne lehessen a lapot „gumizni” */
body.is-standalone {
  overscroll-behavior: none;
  position: relative;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p  { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { vertical-align: middle; max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

::selection { background: var(--accent); color: #fff; }

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

/* ── Elrendezés ──────────────────────────────────────────────── */
.hb-app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* A tartalom mindig a teljes szélességet használja; csak egy szegélytávolság marad. */
.hb-main {
  flex: 1;
  width: 100%;
  padding: 16px var(--gutter-r) 28px var(--gutter-l);
}
.hb-main--tabbar { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px); }
.hb-main--narrow { max-width: 720px; }

.hb-stack   { display: flex; flex-direction: column; gap: 14px; }
.hb-stack-8 { display: flex; flex-direction: column; gap: 8px; }
.hb-row     { display: flex; align-items: center; gap: 10px; }
.hb-row--wrap { flex-wrap: wrap; }
.hb-row--between { justify-content: space-between; }
.hb-spacer  { flex: 1; }

.hb-grid { display: grid; gap: 12px; grid-template-columns: repeat(12, 1fr); }
.hb-grid > .c12 { grid-column: span 12; }
.hb-grid > .c6  { grid-column: span 12; }
.hb-grid > .c4  { grid-column: span 12; }
.hb-grid > .c3  { grid-column: span 6; }
@media (min-width: 640px) {
  .hb-grid > .c6 { grid-column: span 6; }
  .hb-grid > .c4 { grid-column: span 4; }
  .hb-grid > .c3 { grid-column: span 3; }
}
/* Széles képernyőn ne egy-egy mező nyúljon el, hanem több oszlop legyen. */
@media (min-width: 1280px) {
  .hb-grid > .c6  { grid-column: span 4; }
  .hb-grid > .c12 { grid-column: span 8; }
}
@media (min-width: 1750px) {
  .hb-grid > .c6  { grid-column: span 3; }
  .hb-grid > .c4  { grid-column: span 3; }
  .hb-grid > .c12 { grid-column: span 6; }
}
/* Ahol a teljes sor kell (pl. hosszú szöveg), ez felülírja */
.hb-grid > .c12--full { grid-column: span 12 !important; }

/* ── Fejléc ──────────────────────────────────────────────────── */
.hb-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  padding-top: var(--safe-t);
}
@supports not (backdrop-filter: blur(1px)) {
  .hb-header { background: var(--bg-elevated); }
}

/* A fejléc is a teljes szélességet használja: a logó balra, a felhasználó jobbra kifut. */
.hb-header__inner {
  width: 100%;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px var(--gutter-r) 8px var(--gutter-l);
}

/* ── Logó ────────────────────────────────────────────────────── */
.hb-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.hb-logo:hover { text-decoration: none; }
.hb-mark { display: block; border-radius: 14%; flex-shrink: 0; }
.hb-logo__text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.hb-logo__name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.03em;
  white-space: nowrap;
}
.hb-logo__name > span { color: var(--text-3); font-weight: 600; }
.hb-logo__sub {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hb-mark rect:first-child { fill: #23262e; }
}

/* ── Gombok ──────────────────────────────────────────────────── */
.hb-btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border-2);

  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--field-h);
  padding: 0 16px;
  border: 1px solid var(--btn-bd);
  border-radius: var(--r);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  cursor: pointer;
  text-decoration: none;
  transition: transform .06s ease, filter .15s ease, background .15s ease, border-color .15s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  white-space: nowrap;
}
.hb-btn:hover { text-decoration: none; filter: brightness(.98); }
.hb-btn:active { transform: scale(.985); }
.hb-btn:disabled, .hb-btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

.hb-btn--primary { --btn-bg: var(--primary); --btn-fg: var(--primary-ink); --btn-bd: var(--primary); }
.hb-btn--out     { --btn-bg: var(--out);     --btn-fg: #fff; --btn-bd: var(--out); }
.hb-btn--in      { --btn-bg: var(--in);      --btn-fg: #fff; --btn-bd: var(--in); }
.hb-btn--danger  { --btn-bg: var(--danger);  --btn-fg: #fff; --btn-bd: var(--danger); }
.hb-btn--ghost   { --btn-bg: transparent;    --btn-bd: transparent; --btn-fg: var(--text-2); }
.hb-btn--soft    { --btn-bg: var(--surface-3); --btn-bd: transparent; }

.hb-btn--block { width: 100%; }
.hb-btn--sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: var(--r-sm); }
.hb-btn--lg { min-height: 54px; font-size: 16px; border-radius: var(--r-lg); }
.hb-btn--icon { width: var(--field-h); padding: 0; flex-shrink: 0; }
.hb-btn--icon.hb-btn--sm { width: 36px; }

.hb-btn__ico { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Űrlapmezők ──────────────────────────────────────────────── */
.hb-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hb-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: -.005em;
}
.hb-label .req { color: var(--danger); margin-left: 2px; }
.hb-hint { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }

/*  FONTOS: input és select PONTOSAN ugyanúgy néz ki minden platformon.
    A 16px-es betűméret megakadályozza az iOS automatikus nagyítását. */
.hb-input,
.hb-select,
.hb-textarea {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  display: block;
  width: 100%;
  min-height: var(--field-h);
  height: var(--field-h);
  margin: 0;
  padding: 0 14px;

  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: normal;
  color: var(--text);

  background-color: var(--surface);
  background-image: none;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  box-shadow: none;

  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  text-overflow: ellipsis;
}

.hb-textarea {
  height: auto;
  min-height: 96px;
  padding: 12px 14px;
  line-height: 1.5;
  resize: vertical;
}

.hb-input::placeholder,
.hb-textarea::placeholder { color: var(--text-3); font-weight: 450; }

.hb-input:focus,
.hb-select:focus,
.hb-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 16%, transparent);
}

.hb-input:disabled,
.hb-select:disabled,
.hb-textarea:disabled {
  background: var(--surface-3);
  color: var(--text-3);
  opacity: 1;                 /* iOS alapból halványít – ezt kivesszük */
  -webkit-text-fill-color: var(--text-3);
}

.hb-input[readonly] { background: var(--surface-3); }

/*  SELECT: saját nyíl, hogy iOS-en, Androidon és Windowson is
    ugyanúgy nézzen ki, mint egy sima input mező. */
.hb-select {
  padding-right: 42px;
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 15px 15px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238b93a1' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  cursor: pointer;
}
.hb-select::-ms-expand { display: none; }
/* iOS Safari a select szövegét máshogy igazítja – ezzel egálban van az inputtal */
@supports (-webkit-touch-callout: none) {
  .hb-select { padding-top: 0; padding-bottom: 0; text-indent: 0; }
}
.hb-select:invalid, .hb-select[data-empty="1"] { color: var(--text-3); }
.hb-select option { color: var(--text); background: var(--surface); font-weight: 500; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hb-select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%237c8494' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  }
}

/* Dátum- és időmezők iOS-en: ne legyen natív „belső” kinézet */
input[type="date"].hb-input,
input[type="time"].hb-input,
input[type="datetime-local"].hb-input {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: .5;
  cursor: pointer;
}
input[type="number"].hb-input { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

input[type="search"].hb-input { -webkit-appearance: none; }
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/*  Fájlválasztó.
    A natív ::file-selector-button pozicionálása böngészőnként eltér
    (Windows Chrome-ban elcsúszik), ezért a valódi input rejtve van,
    és egy saját, mindenhol egyforma vezérlő váltja ki. */
.hb-file {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: var(--field-h);
  height: var(--field-h);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.hb-file:hover { border-color: var(--text-3); }
.hb-file:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 16%, transparent);
}

/* A valódi input láthatatlan, de kattintható és billentyűzettel elérhető */
.hb-file input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  font-size: 0;
}

.hb-file__btn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 0 16px;
  border-right: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s ease;
}
.hb-file:hover .hb-file__btn { background: var(--border); }
.hb-file__btn svg { width: 16px; height: 16px; color: var(--text-2); }

.hb-file__name {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  padding: 0 14px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hb-file.has-file .hb-file__name { color: var(--text); font-weight: 550; }

@media (max-width: 420px) {
  .hb-file__btn  { padding: 0 12px; font-size: 13.5px; }
  .hb-file__name { padding: 0 10px; font-size: 13px; }
}

/* Mező ikonnal (kereső) */
.hb-input-wrap { position: relative; display: block; }
.hb-input-wrap > .hb-input { padding-left: 42px; }
.hb-input-wrap__ico {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px; height: 17px;
  color: var(--text-3);
  pointer-events: none;
}
.hb-input-wrap__clear {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  display: none;
  align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--text-3);
  cursor: pointer; border-radius: 50%;
}
.hb-input-wrap.has-value .hb-input-wrap__clear { display: flex; }

/* Jelölőnégyzet / kapcsoló */
.hb-check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  min-height: var(--field-h);
}
.hb-check input {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  width: 22px; height: 22px;
  margin: 0;
  border: 1.5px solid var(--border-2);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: background .15s ease, border-color .15s ease;
}
.hb-check input:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.hb-check input:checked::after {
  content: "";
  position: absolute;
  left: 7px; top: 3px;
  width: 5px; height: 10px;
  border: solid var(--primary-ink);
  border-width: 0 2.2px 2.2px 0;
  transform: rotate(43deg);
}
.hb-check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hb-check__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hb-check__title { font-size: 14.5px; font-weight: 600; color: var(--text); }
.hb-check__sub { font-size: 12.5px; color: var(--text-3); }

/* Szegmentált választó (radio-csoport) */
.hb-seg {
  display: flex;
  padding: 3px;
  gap: 3px;
  background: var(--surface-3);
  border-radius: var(--r);
  overflow-x: auto;
  scrollbar-width: none;
}
.hb-seg::-webkit-scrollbar { display: none; }
.hb-seg > a, .hb-seg > button, .hb-seg > label, .hb-seg > span {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.hb-seg > .is-active, .hb-seg > a.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}
.hb-seg > a:hover { text-decoration: none; }

/* ── Kártyák ─────────────────────────────────────────────────── */
.hb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.hb-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.hb-card__title { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.hb-card__sub { font-size: 12.5px; color: var(--text-3); }
.hb-card__body { padding: 16px; }
.hb-card__body--tight { padding: 12px; }
.hb-card__foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.hb-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .075em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 4px 2px;
}

/* ── Statisztika-csempék ─────────────────────────────────────── */
.hb-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 720px) { .hb-stats { grid-template-columns: repeat(4, 1fr); } }

.hb-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.hb-stat__label {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hb-stat__value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.hb-stat__unit { font-size: 13px; font-weight: 600; color: var(--text-3); margin-left: 2px; }
.hb-stat--out   .hb-stat__value { color: var(--out); }
.hb-stat--in    .hb-stat__value { color: var(--in); }
.hb-stat--open  .hb-stat__value { color: var(--warn); }
.hb-stat--ok    .hb-stat__value { color: var(--ok); }

/* ── Listaelemek ─────────────────────────────────────────────── */
.hb-list {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.hb-list__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  background: var(--surface);
  transition: background .12s ease;
  min-height: 62px;
}
.hb-list__item:last-child { border-bottom: 0; }
.hb-list__item:hover { text-decoration: none; background: var(--surface-2); }
.hb-list__item:active { background: var(--surface-3); }
.hb-list__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hb-list__title {
  font-size: 15px; font-weight: 620; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hb-list__sub {
  font-size: 13px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hb-list__meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.hb-list__chev { width: 18px; height: 18px; color: var(--text-3); flex-shrink: 0; }

.hb-avatar {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13.5px; font-weight: 700; letter-spacing: -.02em;
  flex-shrink: 0;
  background: var(--surface-3);
  color: var(--text-2);
}

/* ── Címkék / jelvények ──────────────────────────────────────── */
.hb-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: -.005em;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
  line-height: 1.5;
}
.hb-badge--out    { background: var(--out-soft);    color: var(--out); }
.hb-badge--in     { background: var(--in-soft);     color: var(--in); }
.hb-badge--warn   { background: var(--warn-soft);   color: var(--warn); }
.hb-badge--danger { background: var(--danger-soft); color: var(--danger); }
.hb-badge--ok     { background: var(--ok-soft);     color: var(--ok); }
.hb-badge--accent { background: var(--accent-soft); color: var(--accent); }
.hb-badge--lg     { font-size: 13px; padding: 5px 11px; }
.hb-badge__dot    { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.hb-kbd, .mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.02em; }
.hb-num { font-variant-numeric: tabular-nums; }

/* ── Üzenetek ────────────────────────────────────────────────── */
.hb-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r);
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid transparent;
}
.hb-alert__ico { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.hb-alert--ok   { background: var(--ok-soft);     color: var(--ok);     border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.hb-alert--err  { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.hb-alert--warn { background: var(--warn-soft);   color: var(--warn);   border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.hb-alert--info { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }

.hb-flash-wrap {
  position: sticky;
  top: calc(var(--header-total) + 8px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

/* ── Üres állapot ────────────────────────────────────────────── */
.hb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--text-3);
}
.hb-empty__ico {
  width: 46px; height: 46px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3);
  color: var(--text-3);
  margin-bottom: 4px;
}
.hb-empty__title { font-size: 15.5px; font-weight: 650; color: var(--text-2); }
.hb-empty__text { font-size: 13.5px; max-width: 380px; }

/* ── Táblázat (asztali nézet) ────────────────────────────────── */
.hb-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}
.hb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hb-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.hb-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.hb-table tr:last-child td { border-bottom: 0; }
.hb-table tbody tr:hover { background: var(--surface-2); }
.hb-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb-table a { color: var(--text); font-weight: 600; }

/* ── Mennyiség-léptető ───────────────────────────────────────── */
.hb-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
  flex-shrink: 0;
}
.hb-qty__btn {
  -webkit-appearance: none;
  appearance: none;
  width: 42px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: background .12s ease;
}
.hb-qty__btn:active { background: var(--surface-3); }
.hb-qty__btn:disabled { opacity: .3; pointer-events: none; }
.hb-qty__input {
  -webkit-appearance: none;
  appearance: none;
  -moz-appearance: textfield;
  width: 46px;
  height: 44px;
  border: 0;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding: 0;
}
.hb-qty__input:focus { outline: none; background: var(--accent-soft); }
.hb-qty--on { border-color: var(--out); }
.hb-qty--on .hb-qty__input { color: var(--out); }

/* Eszközsor a kiadás/visszavétel képernyőn */
.hb-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transition: background .15s ease;
}
.hb-pick:last-child { border-bottom: 0; }
.hb-pick.is-selected { background: color-mix(in srgb, var(--out) 5%, var(--surface)); }
.hb-pick__body { flex: 1; min-width: 0; }
.hb-pick__name { font-size: 15px; font-weight: 620; }
.hb-pick__meta { font-size: 12.5px; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

/* ── Aláírás ─────────────────────────────────────────────────── */
.hb-sign {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
  transition: border-color .2s ease, background .2s ease;
}
.hb-sign.has-ink { border-style: solid; border-color: var(--in); background: var(--surface); }
.hb-sign__canvas {
  display: block;
  width: 100%;
  height: 190px;
  touch-action: none;
  cursor: crosshair;
}
.hb-sign__hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
  color: var(--text-3);
  font-size: 13.5px;
  transition: opacity .2s ease;
}
.hb-sign.has-ink .hb-sign__hint { opacity: 0; }
.hb-sign__baseline {
  position: absolute;
  left: 22px; right: 22px; bottom: 34px;
  border-bottom: 1px solid var(--border-2);
  pointer-events: none;
}
.hb-sign__bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.hb-sign__img {
  display: block; width: 100%; max-width: 330px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--r); padding: 6px;
}

/* ── Alsó menüsáv (kiadó felület) ────────────────────────────── */
.hb-tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--border);
  padding: 4px max(4px, var(--safe-l)) calc(var(--safe-b)) max(4px, var(--safe-r));
}
@supports not (backdrop-filter: blur(1px)) {
  .hb-tabbar { background: var(--bg-elevated); }
}
.hb-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: calc(var(--tabbar-h) - 8px);
  padding: 6px 2px;
  color: var(--text-3);
  text-decoration: none;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  border-radius: var(--r-sm);
  transition: color .15s ease;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.hb-tab:hover { text-decoration: none; }
.hb-tab svg { width: 22px; height: 22px; }
.hb-tab.is-active { color: var(--text); }
.hb-tab__badge {
  position: absolute;
  top: 3px;
  left: 50%;
  margin-left: 5px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--warn);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-elevated);
  box-sizing: content-box;
}

/* ── Admin oldalsáv: összecsukható ikonsáv ───────────────────── */
.hb-shell { display: flex; flex: 1; width: 100%; align-items: stretch; }

/*  A .hb-side a helyőrző az elrendezésben, a .hb-side__panel a látható sáv.
    Így mobilon a panel a tartalom fölé tud úszni anélkül, hogy eltolná. */
.hb-side {
  --side-w:      248px;
  --side-w-rail:  68px;

  position: sticky;
  top: var(--header-total);
  height: calc(100dvh - var(--header-total));
  align-self: flex-start;

  width: var(--side-w);
  flex-shrink: 0;
  z-index: 35;
  transition: width .26s cubic-bezier(.2, .8, .3, 1);
}
.hb-side.is-rail { width: var(--side-w-rail); }

.hb-side__panel {
  position: absolute;
  inset: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 14px 10px 10px max(10px, var(--safe-l));
  transition: width .26s cubic-bezier(.2, .8, .3, 1), box-shadow .26s ease;
}
.hb-side.is-rail .hb-side__panel { padding-left: max(8px, var(--safe-l)); padding-right: 8px; }

/* Kerek nyitó/záró gomb a sáv szélén, félig kilógva */
.hb-side__toggle {
  position: absolute;
  right: -13px;
  top: 16px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  box-shadow: var(--shadow-1);
  transition: color .15s ease, background .15s ease;
}
.hb-side__toggle:hover { color: var(--text); background: var(--surface-3); }
.hb-side__toggle svg { transition: transform .26s cubic-bezier(.2, .8, .3, 1); }
.hb-side.is-rail .hb-side__toggle svg { transform: rotate(180deg); }

.hb-side__nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}
.hb-side__nav::-webkit-scrollbar { width: 6px; }
.hb-side__nav::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

.hb-side__group { margin-bottom: 16px; }
.hb-side__group:last-child { margin-bottom: 0; }
.hb-side__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 10px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
}

.hb-side__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  margin-bottom: 2px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
.hb-side__link:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.hb-side__link.is-active { background: var(--surface-3); color: var(--text); font-weight: 650; }
.hb-side__link svg { width: 19px; height: 19px; flex-shrink: 0; color: var(--text-3); }
.hb-side__link.is-active svg { color: var(--text); }
.hb-side__link .hb-badge { margin-left: auto; }
.hb-side__link-text { overflow: hidden; text-overflow: ellipsis; }

/* Nyitott állapotban bal oldali jel mutatja az aktív menüpontot */
.hb-side__link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--text);
}

.hb-side__foot {
  flex-shrink: 0;
  padding-top: 10px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
}

/* ── Összecsukott (ikon) állapot ─────────────────────────────── */
.hb-side.is-rail .hb-side__label {
  height: 1px;
  padding: 0;
  margin: 0 10px 10px;
  background: var(--border);
  color: transparent;
}
.hb-side.is-rail .hb-side__group:first-child .hb-side__label { display: none; }
.hb-side.is-rail .hb-side__link {
  justify-content: center;
  gap: 0;
  padding: 0;
  width: 44px;
  height: 44px;
  margin: 0 auto 4px;
}
.hb-side.is-rail .hb-side__link-text,
.hb-side.is-rail .hb-side__link .hb-badge { display: none; }
.hb-side.is-rail .hb-side__link.is-active::before { display: none; }

.hb-shell__main { flex: 1; min-width: 0; padding: 16px var(--gutter-r) 40px var(--gutter-l); }

/* ── Mobil: a sáv ikonos marad, nyitáskor a tartalom fölé úszik ── */
.hb-side__backdrop {
  position: fixed;
  inset: 0;
  z-index: 34;
  background: rgba(10, 12, 16, .4);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: hb-fade .16s ease;
}
.hb-side__backdrop[hidden] { display: none; }

@media (max-width: 899px) {
  /* A helyőrző mindig keskeny marad, így a tartalom nem ugrál */
  .hb-side { --side-w-rail: 58px; width: var(--side-w-rail) !important; }
  .hb-side.is-open .hb-side__panel {
    width: var(--side-w);
    padding-left: max(10px, var(--safe-l));
    padding-right: 10px;
    box-shadow: var(--shadow-3);
  }
  .hb-side__toggle { right: -12px; width: 24px; height: 24px; }
  .hb-side.is-rail .hb-side__link { width: 42px; height: 42px; }
}
@media (min-width: 900px) {
  .hb-side__backdrop { display: none !important; }
}

/* ── Lenyíló menü ────────────────────────────────────────────── */
.hb-menu { position: relative; }
.hb-menu__panel {
  position: absolute;
  right: 0; top: calc(100% + 8px);
  min-width: 232px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  padding: 6px;
  z-index: 60;
  display: none;
}
.hb-menu.is-open .hb-menu__panel { display: block; animation: hb-pop .14s ease; }
@keyframes hb-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.hb-menu__item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 0; background: transparent;
  border-radius: var(--r-sm);
  color: var(--text);
  font: inherit; font-size: 14.5px; font-weight: 550;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.hb-menu__item:hover { background: var(--surface-3); text-decoration: none; }
.hb-menu__item svg { width: 17px; height: 17px; color: var(--text-3); flex-shrink: 0; }
.hb-menu__sep { height: 1px; background: var(--border); margin: 5px 4px; }
.hb-menu__head { padding: 10px 11px 8px; }
.hb-menu__name { font-size: 14.5px; font-weight: 650; }
.hb-menu__role { font-size: 12.5px; color: var(--text-3); }

/* ── Napválasztó ─────────────────────────────────────────────── */
.hb-days {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px;
  margin: 0 -2px;
}
.hb-days::-webkit-scrollbar { display: none; }
.hb-day {
  flex-shrink: 0;
  min-width: 78px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  display: flex; flex-direction: column; gap: 1px;
  transition: all .14s ease;
}
.hb-day:hover { text-decoration: none; border-color: var(--border-2); }
.hb-day__no { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.hb-day__date { font-size: 14.5px; font-weight: 650; color: var(--text); }
.hb-day__sub { font-size: 11px; color: var(--text-3); }
.hb-day.is-active {
  background: var(--primary);
  border-color: var(--primary);
}
.hb-day.is-active .hb-day__no,
.hb-day.is-active .hb-day__date,
.hb-day.is-active .hb-day__sub { color: var(--primary-ink); }
.hb-day.is-active .hb-day__no { opacity: .65; }
.hb-day.is-today::after {
  content: "";
  display: block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  margin: 2px auto 0;
}
.hb-day.is-active.is-today::after { background: var(--primary-ink); }

/* ── Esemény-sáv ─────────────────────────────────────────────── */
.hb-eventbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 14px;
}
.hb-eventbar__name { font-size: 14.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-eventbar__meta { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Belépőképernyő ──────────────────────────────────────────── */
.hb-auth {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(24px, var(--safe-t)) 20px calc(24px + var(--safe-b));
  background:
    radial-gradient(1000px 520px at 50% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    var(--bg);
}
.hb-auth__box { width: 100%; max-width: 380px; }
.hb-auth__brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; }
.hb-auth__title { font-size: 25px; font-weight: 700; letter-spacing: -.035em; }
.hb-auth__sub { font-size: 14px; color: var(--text-3); text-align: center; }
.hb-auth__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2);
  padding: 22px;
}
.hb-auth__foot { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--text-3); }

/* ── Fejléc: belépett felhasználó ────────────────────────────── */
.hb-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px 5px 12px;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: right;
  max-width: 46vw;
  transition: background .14s ease, border-color .14s ease;
}
.hb-user:hover { background: var(--surface-3); }
.hb-menu.is-open .hb-user { background: var(--surface-3); border-color: var(--border); }

.hb-user__text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
  min-width: 0;
}
.hb-user__name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -.015em;
  color: var(--text);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hb-user__role {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text-3);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hb-user__caret {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  color: var(--text-3);
  flex-shrink: 0;
  margin-left: -2px;
  transition: transform .16s ease;
}
.hb-menu.is-open .hb-user__caret { transform: rotate(180deg); }

/* Nagyon keskeny kijelzőn a logó alcíme adja át a helyet a névnek */
@media (max-width: 420px) {
  .hb-logo__sub { display: none; }
  .hb-user { padding-left: 8px; gap: 7px; max-width: 54vw; }
  .hb-user__name { font-size: 13px; }
}

/* ── Import: oszlop-párosítás mintaadattal ───────────────────── */
.hb-map {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hb-map__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.hb-map__row:last-child { border-bottom: 0; }

.hb-map__label {
  flex: 0 0 168px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hb-map__label .req { color: var(--danger); margin-left: 2px; }

/* A SELECT fix, kényelmes szélességű – nem nyúlik szét a teljes soron */
.hb-map__select { flex: 0 0 300px; max-width: 300px; }

/* Mellette a táblázat első adatsorából vett valódi érték */
.hb-map__sample {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  height: var(--field-h);
  border: 1px dashed var(--border-2);
  border-radius: var(--r);
  background: var(--surface-2);
}
.hb-map__sample-tag {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.hb-map__sample-value {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 550;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hb-map__sample.is-empty { border-style: dashed; background: transparent; }
.hb-map__sample.is-empty .hb-map__sample-value { color: var(--text-3); font-weight: 450; font-style: italic; }

@media (max-width: 860px) {
  .hb-map__row { flex-wrap: wrap; gap: 8px; padding: 12px 0; }
  .hb-map__label { flex: 0 0 100%; }
  .hb-map__select { flex: 1 1 100%; max-width: none; }
  .hb-map__sample { flex: 1 1 100%; }
}

/* ── Modális ablak (natív popup helyett) ─────────────────────── */
.hb-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, var(--safe-t)) 18px calc(20px + var(--safe-b));
}
.hb-modal[hidden] { display: none; }

.hb-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, .45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: hb-fade .16s ease;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hb-modal__backdrop { background: rgba(0, 0, 0, .62); }
}

.hb-modal__box {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  padding: 22px 22px 18px;
  animation: hb-modal-in .2s cubic-bezier(.2, .8, .3, 1);
}
@keyframes hb-fade { from { opacity: 0; } }
@keyframes hb-modal-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
}

.hb-modal__ico {
  width: 44px; height: 44px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3);
  color: var(--text-2);
  margin-bottom: 14px;
}
.hb-modal__ico--danger { background: var(--danger-soft); color: var(--danger); }
.hb-modal__ico--warn   { background: var(--warn-soft);   color: var(--warn); }
.hb-modal__ico--ok     { background: var(--ok-soft);     color: var(--ok); }
.hb-modal__ico--info   { background: var(--accent-soft); color: var(--accent); }

.hb-modal__title {
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -.025em;
  margin-bottom: 6px;
}
.hb-modal__text {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-2);
  margin-bottom: 20px;
  overflow-wrap: anywhere;
}
.hb-modal__actions {
  display: flex;
  gap: 9px;
  flex-direction: column-reverse;
}
.hb-modal__actions .hb-btn { width: 100%; }
@media (min-width: 480px) {
  .hb-modal__actions { flex-direction: row; justify-content: flex-end; }
  .hb-modal__actions .hb-btn { width: auto; min-width: 110px; }
}

body.hb-modal-open { overflow: hidden; }

/* ── Teljes képernyős aláíró ablak ───────────────────────────── */
.hb-sheet {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding: var(--safe-t) var(--gutter-r) var(--safe-b) var(--gutter-l);
  animation: hb-sheet-in .22s cubic-bezier(.2, .8, .3, 1);
}
.hb-sheet[hidden] { display: none; }
@keyframes hb-sheet-in { from { opacity: 0; transform: translateY(14px); } }

.hb-sheet__inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 0 10px;
  gap: 10px;
}

.hb-sheet__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
}
.hb-sheet__head > div:first-child { flex: 1; min-width: 0; }
.hb-sheet__title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.2;
}
.hb-sheet__sub {
  font-size: 13.5px;
  color: var(--text-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Az átvett eszközök kis betűs felsorolása */
.hb-sheet__items {
  flex-shrink: 0;
  padding: 10px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  max-height: 26vh;
  overflow-y: auto;
}
.hb-sheet__items-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}
.hb-sheet__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.hb-sheet__list li {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-2);
}
.hb-sheet__list li b {
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Az aláírófelület kapja a maradék helyet */
.hb-sheet__sign {
  position: relative;
  flex: 1 1 auto;
  min-height: 150px;
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  transition: border-color .2s ease;
}
.hb-sheet__sign.has-ink { border-style: solid; border-color: var(--in); }
.hb-sheet__sign canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.hb-sheet__baseline {
  position: absolute;
  left: 26px; right: 26px; bottom: 30%;
  border-bottom: 1px solid var(--border-2);
  pointer-events: none;
}
.hb-sheet__hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
  color: var(--text-3);
  font-size: 14px;
  transition: opacity .2s ease;
}
.hb-sheet__sign.has-ink .hb-sheet__hint { opacity: 0; }

.hb-sheet__foot {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Aláírás nélkül (pl. visszavételnél) a tartalom legyen függőlegesen középen */
.hb-sheet--nosign .hb-sheet__inner { justify-content: center; gap: 14px; }
.hb-sheet--nosign .hb-sheet__items { max-height: 50vh; }
.hb-sheet__tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hb-sheet__tools .hb-spacer { flex: 1; }

/* Aláírás nélkül nem lehet rögzíteni – halkan jelezzük */
.hb-sheet__need {
  font-size: 12.5px;
  color: var(--text-3);
  text-align: center;
}
.hb-sheet.is-ready .hb-sheet__need { display: none; }

/* Fekvő tájolású telefonon szűkebb a hely */
@media (max-height: 520px) {
  .hb-sheet__items { max-height: 18vh; padding: 7px 11px; }
  .hb-sheet__title { font-size: 16px; }
  .hb-sheet__sign { min-height: 110px; }
}

/* Űrlaphiba a kiadás/visszavétel képernyőn */
.hb-formerror { margin-bottom: 10px; }
.hb-formerror:empty { display: none; }
@keyframes hb-nudge {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-5px); }
  75%      { transform: translateX(5px); }
}
.hb-formerror .hb-alert { animation: hb-nudge .28s ease; }

/* ── Nyomtatás ───────────────────────────────────────────────── */
@media print {
  .hb-header, .hb-tabbar, .hb-side, .no-print, .hb-flash-wrap, .hb-modal, .hb-sheet { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .hb-main { padding: 0; max-width: none; }
  .hb-card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  a { color: #000; }
}

/* ── Apróságok ───────────────────────────────────────────────── */
.t-2 { color: var(--text-2); }
.t-3 { color: var(--text-3); }
.t-sm { font-size: 13px; }
.t-xs { font-size: 12px; }
.t-right { text-align: right; }
.t-center { text-align: center; }
.t-bold { font-weight: 650; }
.t-out { color: var(--out); }
.t-in { color: var(--in); }
.t-warn { color: var(--warn); }
.t-danger { color: var(--danger); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 14px; } .mt-3 { margin-top: 22px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 14px; } .mb-3 { margin-bottom: 22px; }
.hide { display: none !important; }
@media (max-width: 639px) { .hide-sm { display: none !important; } }
@media (min-width: 640px) { .only-sm { display: none !important; } }

.hb-divider { height: 1px; background: var(--border); margin: 2px 0; }

.hb-fab-space { height: 76px; }
.hb-sticky-actions {
  position: sticky;
  bottom: calc(var(--safe-b) + 10px);
  z-index: 20;
  padding: 10px;
  margin: 10px -4px 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-radius: var(--r-lg);
}
/* A kiadó felületen az alsó menüsáv fölött kell megállnia */
.hb-main--tabbar .hb-sticky-actions {
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px);
}

.hb-spin {
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: hb-spin .65s linear infinite;
  display: inline-block;
}
@keyframes hb-spin { to { transform: rotate(360deg); } }

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