/* =========================================================================
   Fully Logistics WMS: app styles
   A plain business application: the menu in a sidebar on the left, the page on white on the right.
   Every page starts with its header (way back, name, buttons on the right); a list page is the
   header, the filter row and the list filling the rest of the window, its column heads staying in
   view. Neutral greys, one blue for the main button, links and focus, colour on statuses only (a
   small dot before the text). Thin lines instead of boxes and shadows.
   Order: tokens, base, shell (sidebar, top bar), page header, filters, small parts, forms, tables,
   dialogs and messages, sign in, list pages, phone, camera, print, labels.
   The handheld face (operator) lives in css/views/handheld.css.
   ========================================================================= */

:root {
  --text: #1d2226;          /* body text */
  --text-2: #5b646d;        /* labels, secondary text */
  --text-3: #8a929a;        /* group headings, separators */
  --line: #dfe3e7;          /* dividers, table head line */
  --line-soft: #eceff2;     /* between table rows */
  --line-strong: #c3c9cf;   /* field and button borders */
  --side: #f5f6f7;          /* sidebar, sign in page */
  --head: #f7f8f9;          /* table heads, dialog foot */
  --hover: #f3f5f7;
  --selected: #e8edf2;
  --accent: #245b8f;        /* main button, links, focus, current menu entry */
  --accent-hover: #1c4a75;
  --ok: #2f7a4b; --ok-bg: #f1f7f3;
  --warn: #9a5b0b; --warn-dot: #d08a1e; --warn-bg: #fcf6ec;
  --danger: #b0281f; --danger-bg: #fcf1f0;
  --info-bg: #f1f5f9;
  --side-w: 13.5rem;
  --head-h: 3.25rem;        /* page header and the brand above the menu */
  --pad: 1.25rem;
  --gap: 1.5rem;
  --radius: 3px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 14px/1.45 system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: #fff;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
h1 { font-size: 1.0625rem; font-weight: 600; }
h2 { font-size: 0.9375rem; font-weight: 600; }
h3 { font-size: 0.875rem; font-weight: 600; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
.icon { display: inline-block; flex: none; width: 1.1em; height: 1.1em; vertical-align: -0.18em; fill: currentColor; }
.muted, .sub, .field__hint, .field__opt { color: var(--text-2); }
.small, .sub, .field__hint, .field__opt { font-size: 0.8125rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace; font-size: 0.95em; }
.nowrap, .num { white-space: nowrap; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.noscript { padding: var(--pad); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Shell: sidebar on the left, the page on the right ---------- */
.shell { display: flex; min-height: 100vh; }
.main { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.content { flex: 1; min-width: 0; padding: 0 var(--pad) var(--pad); }
.content > section { display: grid; gap: var(--gap); align-content: start; }
.content > section > * { min-width: 0; }
.content > section > :first-child:not(.page-head) { margin-top: var(--pad); }

.sidebar {
  position: sticky; top: 0; z-index: 30; display: flex; flex: none; flex-direction: column;
  width: var(--side-w); height: 100vh; background: var(--side); border-right: 1px solid var(--line);
}
.sidebar__top { display: flex; flex: none; align-items: center; height: var(--head-h); padding: 0 0.375rem 0 1rem; border-bottom: 1px solid var(--line); }
.sidebar__brand { display: flex; flex: 1; align-items: center; gap: 0.375rem; min-width: 0; font-weight: 700; color: var(--text); white-space: nowrap; }
.logo { flex: none; width: 1.5rem; height: 1.5rem; margin-right: 0.25rem; border-radius: 2px; }
.sidebar__fold { color: var(--text-3); }
.sidebar__fold:hover { color: var(--text); }
.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand span { font-weight: 400; color: var(--text-2); }
.nav { flex: 1; min-height: 0; overflow-y: auto; padding: 0.5rem 0 1rem; }
/* A main entry (a group's button, or a page of its own like Teendők) and under an open group its
   pages, indented. A closed group shows the sum of what waits in it. */
.nav__group + .nav__group { margin-top: 0.125rem; }
.nav__toggle, .nav__link { display: flex; align-items: center; gap: 0.5rem; width: 100%; min-height: 2rem; padding: 0 0.75rem 0 1rem; color: var(--text); }
.nav__toggle { font-weight: 600; text-align: left; background: none; border: 0; cursor: pointer; }
.nav__group--single .nav__link { font-weight: 600; }
.nav__group[data-group] .nav__link { padding-left: 1.75rem; }
.nav__toggle:hover, .nav__link:hover { text-decoration: none; background: var(--hover); }
.nav__toggle > .icon { width: 0.75rem; height: 0.75rem; margin-left: 0.125rem; color: var(--text-3); transition: transform 0.15s; }
.nav__group[data-open="false"] .nav__toggle > .icon { transform: rotate(-90deg); }
.nav__group[data-open="true"] .nav__toggle > .icon { margin-left: auto; }
.nav__group[data-open="true"] .nav__toggle .nav__count { display: none; }
.nav__group.is-current[data-open="false"] .nav__toggle { box-shadow: inset 3px 0 0 var(--accent); }
.nav__group ul { padding-bottom: 0.25rem; }
.nav__link[aria-current="page"] { font-weight: 600; background: var(--selected); box-shadow: inset 3px 0 0 var(--accent); }
.nav__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__count { margin-left: auto; font-size: 0.75rem; font-weight: 400; color: var(--text-2); font-variant-numeric: tabular-nums; }
.nav__count:not(:empty) { min-width: 1.5rem; padding: 0 0.3125rem; line-height: 1.25rem; text-align: center; background: #e5e8eb; border-radius: var(--radius); }
.sidebar__foot { display: grid; flex: none; gap: 0.125rem; padding: 0.5rem; border-top: 1px solid var(--line); }
.cutoff { display: flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.5rem; font-size: 0.75rem; color: var(--text-2); white-space: nowrap; }
.cutoff b { font-weight: 600; color: var(--text); }
.cutoff[data-state="soon"] b { color: var(--warn); }
.cutoff[data-state="passed"] b { font-weight: 400; color: var(--text-2); }

.user-menu { position: relative; }
.user-menu__btn {
  display: flex; align-items: center; gap: 0.5rem; width: 100%; min-height: 2.5rem; padding: 0.25rem 0.5rem;
  text-align: left; background: none; border: 0; border-radius: var(--radius); cursor: pointer;
}
.user-menu__btn:hover { background: var(--hover); }
.user-menu__btn > .icon:first-child { width: 1.5rem; height: 1.5rem; color: var(--text-2); }
.user-menu__btn > .icon:last-child { width: 0.75rem; height: 0.75rem; margin-left: auto; color: var(--text-3); }
.user-menu__text { display: grid; min-width: 0; line-height: 1.25; }
.user-menu__name, .user-menu__role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu__role { font-size: 0.75rem; color: var(--text-2); }
.popover {
  position: absolute; z-index: 40; display: grid; min-width: 13rem; padding: 0.25rem 0;
  background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 4px 14px rgba(20, 30, 40, 0.1);
}
.user-menu--side .popover { left: 0; right: 0; bottom: calc(100% + 0.25rem); }
.user-menu--top .popover { right: 0; top: calc(100% + 0.25rem); }
.popover button, .popover a {
  display: flex; align-items: center; gap: 0.5rem; width: 100%; min-height: 2rem; padding: 0 0.875rem;
  text-align: left; color: var(--text); background: none; border: 0; cursor: pointer;
}
.popover button:hover, .popover a:hover { text-decoration: none; background: var(--hover); }
.popover .icon { color: var(--text-2); }
.popover hr { width: 100%; margin: 0.25rem 0; border: 0; border-top: 1px solid var(--line); }

/* The slim bar on top: the handheld face (handheld.css) and phones only. */
.topbar { display: none; align-items: center; gap: 0.25rem; min-height: 3rem; padding: 0 0.375rem; background: #fff; border-bottom: 1px solid var(--line); }
.topbar__title { flex: 1; min-width: 0; padding: 0 0.25rem; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.topbar .topbar__menu, .topbar .topbar__back, .topbar .topbar__home { display: none; }
.topbar .user-menu__btn { width: auto; }
.topbar .user-menu__text { display: none; }
.scrim, .shell > .side-open { display: none; }

/* Folded sidebar (desktop): the page takes the whole width, the menu button at the top left opens
   the sidebar over the page. */
@media (min-width: 641px) {
  .app[data-side="folded"]:not(.app--handheld) .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; height: auto;
    transform: translateX(-100%); transition: transform 0.2s ease-out;
  }
  .app[data-side="folded"][data-nav="open"]:not(.app--handheld) .sidebar { transform: none; box-shadow: 4px 0 20px rgba(20, 30, 40, 0.15); }
  .app[data-side="folded"][data-nav="open"]:not(.app--handheld) .scrim { position: fixed; inset: 0; z-index: 55; display: block; background: rgba(20, 26, 32, 0.2); }
  .app[data-side="folded"]:not(.app--handheld) .side-open { position: fixed; z-index: 7; left: 0.625rem; top: calc((var(--head-h) - 2rem) / 2); display: inline-flex; }
  .app[data-side="folded"]:not(.app--handheld) .page-head { padding-left: 3.25rem; }
}

/* ---------- Page header: way back and name on the left, the buttons on the right ---------- */
.page-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem;
  min-height: var(--head-h); margin-inline: calc(-1 * var(--pad)); padding: 0.5rem var(--pad);
  background: #fff; border-bottom: 1px solid var(--line);
}
.content > section:not(.list-page) > .page-head { position: sticky; top: 0; z-index: 6; }
.page-head__text { display: flex; align-items: baseline; gap: 0.5rem; min-width: 0; }
.page-head__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb { flex: none; color: var(--text-2); }
.crumb:hover { color: var(--accent); }
.crumb__sep { color: var(--text-3); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }

/* ---------- Filters above a list: the fields in one row, then Keresés ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 0.75rem; }
.toolbar .field { min-width: 11rem; }
.toolbar .field:not(.field--grow) { max-width: 15rem; }
.toolbar .field--grow { flex: 1 1 14rem; max-width: 30rem; }
.toolbar__buttons { align-self: flex-end; }
.toolbar .toolbar__toggle { display: none; }
.content form.toolbar[data-filters] { margin-inline: calc(-1 * var(--pad)); padding: 0.625rem var(--pad) 0.75rem; background: #fff; border-bottom: 1px solid var(--line); }
.content > section > form.toolbar[data-filters] { margin-top: calc(-1 * var(--gap)); }

/* ---------- Small parts ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; min-height: 2rem; padding: 0 0.75rem;
  font-size: 0.8125rem; font-weight: 500; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer;
  color: var(--text); background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.btn:hover { text-decoration: none; background: var(--hover); border-color: #aab1b9; }
.btn:active { background: var(--selected); }
.btn .icon { width: 1rem; height: 1rem; }
.btn--primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--primary:active { background: var(--accent-hover); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--hover); border-color: transparent; }
.btn--danger { color: var(--danger); border-color: #dfb3af; }
.btn--danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn--sm { min-height: 1.625rem; padding: 0 0.5rem; font-size: 0.75rem; }
.btn--lg { min-height: 2.5rem; padding: 0 1rem; font-size: 0.875rem; }
.btn--icon { min-width: 2rem; padding: 0; }
.btn--sm.btn--icon { min-width: 1.625rem; }
/* a small gear beside a value, e.g. the article's stock alerts */
.btn--xs { min-height: 1.375rem; min-width: 1.375rem; margin: -0.25rem 0 -0.25rem 0.25rem; color: var(--text-2); vertical-align: middle; }
.btn--xs:hover { color: var(--text); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: default; pointer-events: none; }
.btn[aria-busy="true"] { cursor: progress; opacity: 0.7; }
.link-btn { padding: 0; font: inherit; color: var(--accent); background: none; border: 0; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Status: the text with a small coloured dot before it. */
.chip { display: inline-flex; align-items: center; gap: 0.375rem; white-space: nowrap; }
.chip::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; background: #a3abb3; border-radius: 50%; }
.chip[data-tone="ok"]::before { background: var(--ok); }
.chip[data-tone="warn"]::before { background: var(--warn-dot); }
.chip[data-tone="danger"]::before { background: var(--danger); }
.chip[data-tone="info"]::before, .chip[data-tone="accent"]::before { background: var(--accent); }
.chip[data-tone="danger"] { color: var(--danger); }
.chip + .chip { margin-left: 0.5rem; }
.tag { padding: 0 0.25rem; font-size: 0.75rem; white-space: nowrap; background: #fff; border: 1px solid var(--line); border-radius: 2px; }
.tag + .tag { margin-left: 0.25rem; }
.count { color: var(--text-2); font-variant-numeric: tabular-nums; }
.diff-pos { color: var(--ok); }
.diff-neg { color: var(--danger); }

/* A part of a record page: its heading over a line, then the content. */
.panel { display: grid; gap: 0.75rem; align-content: start; min-width: 0; }
.panel > * { min-width: 0; }
.panel > h2, .panel__head { padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.panel > h2:has(+ .table-wrap .table) { padding-bottom: 0; border-bottom: 0; } /* the table's head is the line */
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 0.75rem; }
.panel__head h2 { padding: 0; border: 0; }
.grid-2 { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); align-items: start; }
.grid-3 { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); align-items: start; }

/* Facts of a record: label and value pairs, two pairs a row where it fits. */
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 11rem) minmax(12rem, 1fr)); gap: 0.375rem 1rem; }
.dl dt { color: var(--text-2); }
.dl dd { min-width: 0; overflow-wrap: anywhere; }

/* The page of an article or a client: its photo (or the client's code) top left, its name and
   data beside it. */
.profile { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 0.75rem 1.5rem; align-items: start; }
.profile__media {
  display: grid; place-items: center; width: 11rem; height: 11rem; overflow: hidden; padding: 0;
  font: inherit; color: var(--text-3); background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.profile__media img { width: 100%; height: 100%; object-fit: contain; }
.profile__media--empty { align-content: center; gap: 0.375rem; cursor: pointer; }
.profile__media--empty:hover { color: var(--text-2); background: var(--hover); }
.profile__media--empty .icon { width: 2rem; height: 2rem; }
.profile__media--mark { font-size: 1.375rem; font-weight: 700; letter-spacing: 0.04em; color: var(--text-2); background: var(--side); }
.profile__body { display: grid; gap: 0.875rem; align-content: start; min-width: 0; }
.profile__name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; }
.profile__name h2 { font-size: 1.25rem; }
.profile--compact { grid-template-columns: 4.5rem minmax(0, 1fr); align-items: center; }
.profile--compact .profile__media { width: 4.5rem; height: 4.5rem; }
.profile--compact .profile__media--mark { font-size: 0.875rem; }
.profile--compact .profile__body { gap: 0.25rem; }
.profile + .tabs { margin-top: calc(-0.5 * var(--gap)); }
.tariff-table { max-width: 56rem; table-layout: fixed; }
.tariff-table th:nth-child(2) { width: 10rem; }
.tariff-table th:nth-child(3) { width: 16rem; }
.table td.w-price { padding-block: 0.25rem; }
.nt-table { table-layout: fixed; }
.nt-table th:nth-child(1) { width: 2.5rem; }
.nt-table th:nth-child(3) { width: 10.5rem; }
.nt-table th:nth-child(4), .nt-table th:nth-child(5) { width: 6.75rem; }
.nt-table th:nth-child(6) { width: 7.5rem; }
.recip-list { display: grid; gap: 0.5rem; }
.recip-row { display: flex; gap: 0.25rem; align-items: center; }
.recip-row .input { flex: 1; }
.nt-table th:nth-child(7) { width: 8.75rem; }
.nt-table td.nt-field { padding-block: 0.25rem; }
.nt-table .select, .nt-table .input { width: 100%; min-height: 1.75rem; }
.table td.w-price .input { width: 100%; min-height: 1.75rem; }
@media (max-width: 640px) {
  .profile { grid-template-columns: minmax(0, 1fr); }
  .profile__media { width: 7rem; height: 7rem; }
  .profile--compact { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .profile--compact .profile__media { width: 4.5rem; height: 4.5rem; }
}

/* a line of a manual order: article (search), quantity, delete */
.order-line { display: grid; grid-template-columns: minmax(0, 1fr) 6rem auto; gap: 0.5rem; align-items: end; margin-bottom: 0.5rem; }
/* photo thumbnails in a single-line table row */
.thumbs { display: inline-flex; gap: 0.25rem; vertical-align: middle; }
.thumbs img { display: block; width: 1.5rem; max-width: none; height: 1.5rem; object-fit: cover; border: 1px solid var(--line); border-radius: 2px; }
.empty { display: grid; justify-items: center; gap: 0.5rem; padding: 2.5rem 1rem; text-align: center; color: var(--text-2); }
.empty .icon { width: 1.5rem; height: 1.5rem; color: var(--text-3); }
.loading { padding: 1rem 0; color: var(--text-2); }
.tabs { display: flex; flex-wrap: wrap; gap: 0 1.5rem; border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.625rem 0 0.5rem; margin-bottom: -1px; color: var(--text-2); border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
progress { vertical-align: middle; accent-color: var(--accent); }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1rem; }
.form-grid { display: grid; gap: 0.75rem 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.field { display: grid; gap: 0.25rem; align-content: start; min-width: 0; }
.field > label, .field__label { font-size: 0.75rem; font-weight: 500; color: var(--text-2); }
.field__error { display: flex; gap: 0.375rem; align-items: center; font-size: 0.8125rem; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-width: 0; min-height: 2rem; padding: 0 0.5rem; font-size: 0.875rem; color: var(--text);
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.textarea { min-height: 5rem; padding-block: 0.375rem; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: #9ea6ae; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.input[readonly] { background: var(--head); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input--num { text-align: right; }
.input--code { text-transform: uppercase; }
.input--code::placeholder { text-transform: none; }
.check { display: inline-flex; gap: 0.5rem; align-items: center; }
.check input { accent-color: var(--accent); }
.input-group { display: flex; gap: 0.25rem; }
.input-group .input { flex: 1; }
.scan { display: flex; gap: 0.5rem; align-items: center; }
.scan > .icon { color: var(--text-2); }
.scan input {
  flex: 1; min-width: 0; min-height: 2rem; padding: 0 0.5rem; background: #fff;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.scan input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.scan .scan__btn { display: none; color: var(--text-2); background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; }
.scan .scan__btn:hover { background: var(--hover); }
.scan .scan__btn[aria-pressed="true"] { color: var(--text); background: var(--selected); }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; align-items: center; }
.form-actions .muted { margin-right: auto; }

/* Autocomplete list under a field */
.ac-list {
  position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 2px); max-height: 18rem; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 4px 14px rgba(20, 30, 40, 0.1);
}
.ac-list li { display: grid; padding: 0.375rem 0.625rem; cursor: pointer; }
.ac-list li[aria-selected="true"], .ac-list li:hover { background: var(--selected); }
.ac-list .ac-none { color: var(--text-2); cursor: default; }

/* ---------- Tables: the full width, every row one line ---------- */
.table-wrap { position: relative; overflow-x: auto; background: #fff; }
.table { width: 100%; font-size: 0.8125rem; font-variant-numeric: tabular-nums; border-collapse: separate; border-spacing: 0; } /* separate: sticky heads keep their background */
.table th, .table td { padding: 0.4375rem 0.625rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line-soft); }
/* Every row is one line (the owner's rule): no wrapping, a long value is cut with an ellipsis, the
   whole text is in the cell's tooltip (core/app.js sets it). */
.table th, .table td { white-space: nowrap; }
.table td { max-width: 20rem; overflow: hidden; text-overflow: ellipsis; }
.table thead th { font-size: 0.75rem; font-weight: 600; color: var(--text-2); background: var(--head); border-top: 1px solid var(--line); border-bottom-color: var(--line); }
.table tbody tr:hover td { background: #f8fafb; }
.table tr[data-href], .table tr[data-opens] { cursor: pointer; }
.table .w-thumb { width: 2.25rem; padding-right: 0; }
.table td.cap-s { max-width: 7rem; }
.table td.cap-m { max-width: 11rem; }
.table tr[data-selected="true"] td { background: var(--selected); }
.table tfoot td { font-weight: 600; background: var(--head); border-top: 1px solid var(--line); }
.table .r, .table .num { text-align: right; }
.table .c { text-align: center; }
.table .w-check { width: 2rem; }
.table .w-actions { width: 1%; }
.table td .sub { color: var(--text-2); font-size: 0.75rem; }
.table td .btn + .btn { margin-left: 0.25rem; }
.table-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.375rem 0; font-size: 0.8125rem; color: var(--text-2); }

/* ---------- Dialogs and messages ----------
   Every dialog is a full height panel that slides in from the right (FL.ui.dialog animates the
   closing too): the title on top, the body scrolls, the buttons stay at the bottom. */
dialog.dialog {
  position: fixed; inset: 0 0 0 auto; width: min(42rem, 100vw); max-width: 100vw; height: 100%; max-height: 100%; margin: 0; padding: 0;
  color: var(--text); background: #fff; border: 0; border-left: 1px solid var(--line); box-shadow: -6px 0 24px rgba(20, 30, 40, 0.12);
}
dialog.dialog--wide { width: min(64rem, 100vw); }
dialog.dialog--narrow { width: min(28rem, 100vw); }
dialog.dialog::backdrop { background: rgba(20, 26, 32, 0.32); }
.dialog__inner { display: flex; flex-direction: column; height: 100%; }
.dialog__head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 1rem; min-height: var(--head-h); padding: 0 0.75rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.dialog__head h2 { font-size: 1rem; }
.dialog__body { display: grid; flex: 1 1 auto; gap: 1rem; align-content: start; min-height: 0; padding: 1.25rem; overflow-y: auto; }
.dialog__foot { flex: none; padding: 0.625rem 1.25rem; background: var(--head); border-top: 1px solid var(--line); }
dialog.dialog[open] { animation: dialog-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
dialog.dialog[open]::backdrop { animation: backdrop-in 0.22s ease-out; }
dialog.dialog.is-closing { animation: dialog-out 0.18s ease-in forwards; }
dialog.dialog.is-closing::backdrop { animation: backdrop-out 0.18s ease-in forwards; }
@keyframes dialog-in { from { transform: translateX(100%); } }
@keyframes dialog-out { to { transform: translateX(100%); } }
@keyframes backdrop-in { from { opacity: 0; } }
@keyframes backdrop-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  dialog.dialog[open], dialog.dialog[open]::backdrop, dialog.dialog.is-closing, dialog.dialog.is-closing::backdrop { animation: none; }
}

.notice {
  display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.5rem 0.75rem;
  background: var(--info-bg); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius);
}
.notice > .icon { margin-top: 0.1em; color: var(--accent); }
.notice[data-tone="ok"] { background: var(--ok-bg); border-left-color: var(--ok); }
.notice[data-tone="ok"] > .icon { color: var(--ok); }
.notice[data-tone="warn"] { background: var(--warn-bg); border-left-color: var(--warn-dot); }
.notice[data-tone="warn"] > .icon { color: var(--warn); }
.notice[data-tone="danger"] { background: var(--danger-bg); border-left-color: var(--danger); }
.notice[data-tone="danger"] > .icon { color: var(--danger); }

.toasts { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; display: grid; gap: 0.5rem; width: min(24rem, calc(100vw - 2rem)); }
.toast {
  display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.625rem 0.875rem; color: #fff;
  background: #2a3036; border-left: 3px solid #8a939c; border-radius: var(--radius); box-shadow: 0 4px 14px rgba(20, 30, 40, 0.18);
}
.toast[data-tone="ok"] { border-left-color: #5fb07e; }
.toast[data-tone="error"], .toast[data-tone="danger"] { border-left-color: #e0645b; }
.toast[data-tone="warn"] { border-left-color: #e0a040; }
.toast p { flex: 1; }

/* ---------- Sign in ---------- */
.auth { display: grid; place-items: center; min-height: 100vh; padding: 1rem; background: var(--side); }
.auth__card { width: min(24rem, 100%); padding: 2rem; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.auth__body { display: grid; gap: 1.25rem; }
.auth__brand { display: flex; align-items: center; gap: 0.375rem; font-weight: 700; }
.auth__brand .logo { width: 2rem; height: 2rem; }
.auth__brand span { display: inline; margin-left: 0.375rem; font-weight: 400; color: var(--text-2); }
.auth h1 { font-size: 1.25rem; }
.auth .btn--lg { width: 100%; }

/* ---------- List pages: the page is the list ----------
   The header, the tabs and the filters on top, the list fills the rest of the window and scrolls
   on its own, its column heads stay in view, the count or pager at the bottom. Views mark these
   pages .list-page. */
.content:has(> .list-page) { padding: 0; }
.content > .list-page { gap: 0; }
.list-page > .page-head, .list-page > form.toolbar[data-filters] { margin-inline: 0; }
.list-page > .tabs { padding-inline: var(--pad); }
.list-page > .notice { margin: 0.75rem var(--pad) 0; }
.list-page > .list-note { padding: 0.5rem var(--pad); }
.content > .list-page > form.toolbar[data-filters] { margin-top: 0; }
.list-page .table thead th { border-top: 0; }
.list-page .table tr > :first-child { padding-left: var(--pad); }
.list-page .table tr > :last-child { padding-right: var(--pad); }
.list-page .table-foot { padding: 0.375rem var(--pad); background: #fff; border-top: 1px solid var(--line); }
.list-page .panel { gap: 0; }
.list-page .panel > :not(.table-wrap):not(:has(.table-wrap)) { padding-inline: var(--pad); }

@media (min-width: 641px) {
  .shell { height: 100vh; }
  .main { min-height: 0; }
  .content { min-height: 0; overflow: auto; }
  .content:has(> .list-page) { display: flex; flex-direction: column; overflow: hidden; }
  .content > .list-page { display: flex; flex: 1; flex-direction: column; min-height: 0; }
  .list-page > *, .list-page :has(.table-wrap) > * { flex: none; }
  .list-page :has(.table-wrap) { display: flex; flex: 1 1 0; flex-direction: column; min-height: 0; }
  .list-page .table-wrap { flex: 1 1 0; min-height: 0; overflow: auto; }
  .list-page .table thead th { position: sticky; top: 0; z-index: 1; }
}

/* ---------- Phone (client portal; staff get the handheld face) ----------
   The sidebar slides in from the left with the menu button of the top bar; 44px touch targets,
   16px text in fields (no zoom on focus), the filters behind a button. */
@media (max-width: 640px) {
  :root { --pad: 0.75rem; --gap: 1rem; }
  .app:not(.app--handheld) .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; width: min(18rem, 85vw); height: auto;
    transform: translateX(-100%); transition: transform 0.2s ease-out;
  }
  .app[data-nav="open"]:not(.app--handheld) .sidebar { transform: none; box-shadow: 4px 0 20px rgba(20, 30, 40, 0.15); }
  .app[data-nav="open"]:not(.app--handheld) .scrim { position: fixed; inset: 0; z-index: 55; display: block; background: rgba(20, 26, 32, 0.32); }
  .sidebar__fold { display: none; }
  .topbar { position: sticky; top: 0; z-index: 20; display: flex; }
  .app:not(.app--handheld) .topbar .topbar__menu { display: inline-flex; }
  .page-head__text:not(:has(.crumb)) { display: none; } /* the top bar names the page */
  .page-head:not(:has(.page-actions)):not(:has(.crumb)) { display: none; }
  .content > section:not(.list-page) > .page-head { position: static; }
  .form-grid .span-2 { grid-column: 1 / -1; }

  .btn, .input, .select { min-height: 2.75rem; }
  .btn--sm { min-height: 2.25rem; }
  .input, .select, .textarea, .scan input { font-size: 16px; }
  .check { min-height: 2.5rem; }
  .check input { width: 1.25rem; height: 1.25rem; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tab { flex: none; min-height: 2.5rem; }
  .ac-list li { padding: 0.625rem 0.5rem; }
  .scan .scan__btn { display: inline-flex; flex: none; align-items: center; justify-content: center; min-width: 2.75rem; min-height: 2.75rem; }
  .scan > .icon { display: none; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 0.125rem; }
  .dl dd + dt { margin-top: 0.5rem; }

  /* Filters: the search field, the Szűrők button and the Keresés button; the rest on demand */
  .toolbar .field { flex: 1 1 100%; min-width: 0; max-width: none; }
  .toolbar .actions { flex: 1 1 auto; }
  .toolbar .actions .btn { flex: 1 1 auto; }
  .toolbar .toolbar__toggle { display: inline-flex; flex: 1 1 auto; }
  form.toolbar:not([data-filters-open="true"]) > .field:not(.toolbar__keep):has(~ .toolbar__toggle),
  form.toolbar:not([data-filters-open="true"]) > .toolbar__toggle ~ .field { display: none; }
  .page-actions { width: 100%; }
  .page-actions > .btn { flex: 1 1 auto; }

  dialog.dialog, dialog.dialog--wide, dialog.dialog--narrow { width: 100vw; border-left: 0; }
  .dialog__foot .form-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .dialog__foot .form-actions .muted { display: none; }
  .dialog__foot .form-actions .btn { white-space: normal; }
  .toasts { right: 0.5rem; bottom: 0.5rem; left: 0.5rem; width: auto; }
}

/* Camera reading (FL.ui.cameraScan): full screen video with a frame */
dialog.camscan { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; padding: 0; color: #fff; background: #000; border: 0; }
dialog.camscan::backdrop { background: #000; }
.camscan__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camscan__frame { position: absolute; left: 10%; right: 10%; top: 32%; height: 22%; border: 3px solid #fff; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45); }
.camscan__status { position: absolute; left: 1rem; right: 1rem; top: calc(54% + 1rem); text-align: center; }
.camscan[data-error="true"] .camscan__status { top: 40%; padding: 1rem; color: #000; background: #fff; }
.camscan__close { position: absolute; left: 1rem; right: 1rem; bottom: calc(1.5rem + env(safe-area-inset-bottom)); }

/* ---------- Print: only the content, no app chrome ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  .sidebar, .topbar, .scrim, .toasts, .no-print, .page-actions, .toolbar { display: none !important; }
  .shell { display: block; height: auto; }
  .content, .list-page, .list-page .table-wrap { padding: 0; overflow: visible !important; }
  .page-head { position: static; margin: 0 0 4mm; padding: 0; border: 0; }
  .table tr { break-inside: avoid; }
}

/* ---------- Labels (FL.ui.printLabels): only the label sheet prints, one label per page ---------- */
.label-sheet { display: none; }
@media print {
  body.printing-labels > *:not(.label-sheet) { display: none !important; }
  body.printing-labels .label-sheet { display: block; }
  .label { display: grid; align-content: start; gap: 1mm; height: 100%; page-break-after: always; break-after: page; color: #000; font-family: Arial, sans-serif; }
  .label__bars { width: 100%; height: 18mm; }
  .label__code { font-size: 16pt; font-weight: bold; letter-spacing: 0.05em; }
  .label__title { font-size: 10pt; font-weight: bold; }
  .label__line { font-size: 8pt; }
  .label__flag { font-size: 14pt; font-weight: bold; border: 0.6mm solid #000; padding: 0.5mm 2mm; display: inline-block; }
}
