* { box-sizing: border-box; }

[hidden] { display: none !important; }

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #f4f5f7;
  --border: #dde1e6;
  --text: #1c2128;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --accent-bg: #eff6ff;
  --accent-border: #bfdbfe;
  --radius: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --surface: #1e2126;
    --surface-muted: #262a31;
    --border: #383d45;
    --text: #e8eaed;
    --text-muted: #9aa1ac;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --danger: #f87171;
    --success: #4ade80;
    --accent-bg: #1e293b;
    --accent-border: #334155;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --surface: #1e2126;
  --surface-muted: #262a31;
  --border: #383d45;
  --text: #e8eaed;
  --text-muted: #9aa1ac;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --danger: #f87171;
  --success: #4ade80;
  --accent-bg: #1e293b;
  --accent-border: #334155;
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

dialog {
  background: var(--surface);
  color: var(--text);
}

input, select, textarea {
  background: var(--surface);
  color: var(--text);
}

/* A fejléc két sorból áll: fent a navigáció, alatta a terméklista keresője és
   szűrői. Korábban mind a tizenhárom gomb egy sorban volt, és tördelt. */
.topbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar h1 {
  font-size: 19px;
  margin: 0;
  white-space: nowrap;
}

/* A profil és az "+ Új termék" a sor jobb szélére kerül. */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.mainnav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* --- Lenyíló menü --- */

.menu { position: relative; }

.menu-btn::after {
  content: ' ▾';
  font-size: 11px;
  opacity: 0.7;
}

.menu.open > .menu-btn {
  background: var(--surface-muted);
  border-color: var(--text-muted);
}

.menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 60;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

/* A jobb szélső menü befelé nyílik, hogy ne lógjon ki a képernyőről. */
.menu-end .menu-panel { left: auto; right: 0; }

.menu-panel[hidden] { display: none; }

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.menu-item:hover { background: var(--surface-muted); }

.menu-sep {
  height: 1px;
  margin: 6px 4px;
  background: var(--border);
}

.menu-info {
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.current-user-indicator {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- A terméklista keresője és szűrői --- */

.topbar-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-filters input {
  flex: 1 1 260px;
  max-width: 420px;
}

.topbar-filters input,
.topbar-filters select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
}

/* --- Hamburger: csak keskeny képernyőn --- */

.nav-toggle { display: none; }

@media (max-width: 900px) {
  .topbar { padding: 12px 14px; }
  .nav-toggle { display: inline-block; }
  .mainnav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .mainnav.open { display: flex; }
  .menu-panel {
    position: static;
    box-shadow: none;
    border: 0;
    padding: 0 0 0 12px;
    min-width: 0;
  }
  .topbar-right { margin-left: 0; }
  .topbar-filters input { max-width: none; }
}

#search { min-width: 260px; }

main { padding: 24px; }

.product-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.product-table th,
.product-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.product-table th {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.product-table tbody tr:hover { background: var(--surface-muted); cursor: pointer; }

.product-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.product-table th.sortable:hover { color: var(--text); }
.sort-indicator { display: inline-block; width: 10px; margin-left: 3px; opacity: 0.35; }
.sort-indicator.active { opacity: 1; color: var(--primary); }

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.list-toolbar-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.list-toolbar select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
}
.view-mode-toggle { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.view-mode-toggle button {
  border: none;
  background: var(--surface);
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
}
.view-mode-toggle button.active { background: var(--primary); color: #fff; }
.view-mode-toggle button + button { border-left: 1px solid var(--border); }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 0 4px;
  font-size: 13px;
  color: var(--text-muted);
}
.pagination-bar[hidden] { display: none; }
.pagination-bar button:disabled { opacity: 0.4; cursor: not-allowed; }

.scroll-sentinel { height: 1px; }
.scroll-status {
  text-align: center;
  padding: 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.scroll-status[hidden] { display: none; }

.trash-section { margin-bottom: 24px; }
.trash-section h3 { font-size: 14px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.trash-count { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.trash-list { display: flex; flex-direction: column; gap: 6px; }
.trash-empty-hint { font-size: 13px; color: var(--text-muted); padding: 4px 0; }
.trash-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}
.trash-item-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trash-item-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-item-meta { color: var(--text-muted); font-size: 12px; }
.trash-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

.row-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-muted);
  display: block;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-yes { background: #dcfce7; color: #15803d; }
.badge-no { background: #fee2e2; color: #b91c1c; }

.linked-document-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.linked-document-row:last-child { border-bottom: none; }
.linked-document-row a { color: var(--primary); text-decoration: none; }
.linked-document-row a:hover { text-decoration: underline; }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

.btn {
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-muted); }

.btn-small { padding: 6px 10px; font-size: 13px; }

.btn-danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--surface-muted); }

.bulk-bar[hidden] { display: none; }
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.bulk-bar span { font-size: 14px; font-weight: 600; color: var(--text); }
.row-select, .select-all-checkbox { width: 17px; height: 17px; cursor: pointer; }

.btn-icon {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text-muted);
}
.btn-icon:hover { background: var(--surface-muted); color: var(--text); }

dialog#product-dialog {
  width: min(720px, 92vw);
  max-height: 88vh;
  padding: 0;
  border: none;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

dialog#product-dialog[open] {
  display: flex;
  flex-direction: column;
}

#product-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

dialog#product-dialog::backdrop {
  background: rgba(15, 20, 30, 0.5);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.dialog-header h2 { margin: 0; font-size: 18px; }

.dialog-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field input[type=text],
.field input[type=number],
.field input[type=url] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  width: 100%;
  min-width: 0;
}

.field-image { grid-column: span 2; flex-direction: row; align-items: center; gap: 14px; flex-wrap: wrap; }
.field-image label { min-width: 40px; }

.field-description { grid-column: span 2; }
.field-description textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  width: 100%;
  min-width: 0;
}

.image-preview-wrap {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.image-preview { width: 100%; height: 100%; object-fit: cover; }
.image-placeholder { font-size: 11px; color: var(--text-muted); text-align: center; padding: 4px; }

.field-toggle { flex-direction: row; align-items: center; }
.field-toggle label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); }

.barcode-input-row { display: flex; gap: 6px; flex-wrap: wrap; }
.barcode-input-row input { flex: 1; min-width: 120px; }
.barcode-input-row .btn { flex-shrink: 0; white-space: nowrap; }

.input-with-mic { display: flex; gap: 6px; align-items: flex-start; }
.input-with-mic input,
.input-with-mic textarea { flex: 1; min-width: 0; }
.input-with-mic .btn-mic { flex-shrink: 0; font-size: 18px; border: 1px solid var(--border); }
.input-with-mic .btn-mic.listening { background: #fee2e2; color: var(--danger); animation: mic-pulse 1s infinite; }

@keyframes mic-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

dialog.scanner-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: #000;
}

dialog.scanner-overlay[open] {
  display: flex;
  flex-direction: column;
}

.scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.scanner-header .btn-icon { color: #fff; font-size: 20px; }
.scanner-header .btn-icon:hover { background: rgba(255,255,255,0.15); }

#scanner-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#scanner-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-status {
  color: #fff;
  text-align: center;
  padding: 16px;
  margin: 0;
  font-size: 14px;
  background: rgba(0,0,0,0.4);
}

.offers-section { border-top: 1px solid var(--border); padding-top: 16px; }
.offers-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.offers-header h3 { margin: 0; font-size: 15px; }
.hint { font-size: 12px; color: var(--text-muted); margin: 6px 0 12px; }

.status-filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.status-chip {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.status-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.menu-dropdown { position: relative; display: inline-block; }
.menu-dropdown-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 50;
  min-width: 170px;
  overflow: hidden;
}
.menu-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  box-sizing: border-box;
}
.menu-dropdown-item:hover { background: var(--surface-muted); }

.badge-status-leadva { background: #e5e7eb; color: #374151; }
.badge-status-osszekeszites { background: #dbeafe; color: #1d4ed8; }
.badge-status-uton { background: #fef3c7; color: #92400e; }
.badge-status-megerkezett { background: #dcfce7; color: #15803d; }

.badge-return-bejelentve { background: #fee2e2; color: #b91c1c; }
.badge-return-beerkezett { background: #fef3c7; color: #92400e; }
.badge-return-feldolgozas_alatt { background: #dbeafe; color: #1d4ed8; }
.badge-return-lezarva { background: #dcfce7; color: #15803d; }

.badge-reqtype-erdeklodes { background: #e5e7eb; color: #374151; }
.badge-reqtype-arajanlatkeres { background: #dbeafe; color: #1d4ed8; }

.badge-reqstatus-uj { background: #fef3c7; color: #92400e; }
.badge-reqstatus-elfogadva { background: #dcfce7; color: #15803d; }
.badge-reqstatus-elutasitva { background: #fee2e2; color: #b91c1c; }

/* Széles táblázat saját magán belül görögjön, ne az egész oldal. */
.table-scroll { overflow-x: auto; }

.badge-quality-problemas { background: #fee2e2; color: #b91c1c; }
.badge-quality-alap { background: #e5e7eb; color: #374151; }
.badge-quality-jo { background: #dcfce7; color: #15803d; }
.badge-quality-kimondottan_jo { background: #bbf7d0; color: #14532d; }
.badge-quality-ipari { background: #dbeafe; color: #1d4ed8; }

.badge-rating-problemas { background: #fee2e2; color: #b91c1c; }
.badge-rating-megfelelo { background: #e5e7eb; color: #374151; }
.badge-rating-jo { background: #dbeafe; color: #1d4ed8; }
.badge-rating-kivalo { background: #dcfce7; color: #15803d; }

.badge-price-olcso { background: #dcfce7; color: #15803d; }
.badge-price-kozepes { background: #e5e7eb; color: #374151; }
.badge-price-draga { background: #fee2e2; color: #b91c1c; }

.badge-category-termekleiras { background: #dbeafe; color: #1d4ed8; }
.badge-category-tanusitvany { background: #dcfce7; color: #15803d; }
.badge-category-fontos_irat { background: #fee2e2; color: #b91c1c; }
.badge-category-kep { background: #fef3c7; color: #92400e; }
.badge-category-egyeb { background: #e5e7eb; color: #374151; }

.badge-tier-alapvasarlo { background: #e5e7eb; color: #374151; }
.badge-tier-visszajaro { background: #dbeafe; color: #1d4ed8; }
.badge-tier-torzsvasarlo { background: #dcfce7; color: #15803d; }
.badge-tier-kiemelt { background: #fef3c7; color: #92400e; }

.badge-role-admin { background: #fee2e2; color: #b91c1c; }
.badge-role-munkatars { background: #dbeafe; color: #1d4ed8; }
.badge-role-ugyfel { background: #dcfce7; color: #15803d; }

.offer-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  position: relative;
}

.offer-row-main { display: flex; gap: 10px; flex: 1; min-width: 0; }

.offer-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-muted);
  flex-shrink: 0;
}

.offer-fields { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.offer-fields input {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  width: 100%;
  min-width: 0;
}
.offer-fields-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 6px; }

.offer-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.offer-primary { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.offer-status {
  position: absolute;
  bottom: 4px;
  right: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  margin-right: auto;
}

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .field-image { grid-column: span 1; }
  .offer-fields-grid { grid-template-columns: 1fr; }

  dialog#product-dialog {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    border-radius: 0;
  }
}

.portal-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.portal-product-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.portal-product-card img {
  width: 100%;
  height: 120px;
  object-fit: contain;
  background: var(--bg);
  border-radius: 4px;
}
.portal-product-card .ppc-name { font-weight: 600; font-size: 14px; }
.portal-product-card .ppc-price { color: var(--primary); font-weight: 600; }
.portal-product-card .ppc-desc {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.wishlist-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--surface);
}
.wishlist-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.wishlist-card-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wishlist-item-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Lista-szűrősáv: kereső + szűrők a dialógusok listái fölött */
.list-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}
.list-filter-bar input[type="search"] { flex: 1 1 260px; min-width: 200px; }

.chip-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* Beszállítói termékkörök: több is bejelölhető */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px 14px;
}
.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: normal;
  cursor: pointer;
}
.field-wide { grid-column: 1 / -1; }

/* Verziószám a fejlécben -- halvány, hogy ne vonja el a figyelmet */
.app-version {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Katalógus: keresőtalálatok és bevételezés */
.catalog-pager {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
}
.catalog-receive-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.catalog-receive-existing {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
}
#catalog-dialog { max-width: 1200px; width: 95vw; }
#catalog-rows td { vertical-align: middle; }
.catalog-name { font-weight: 500; }
.catalog-noprice { color: var(--text-muted); font-style: italic; }

/* Tömeges műveletek csoportosítása a kijelölés-sávban */
.bulk-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 10px;
  margin-left: 4px;
  border-left: 1px solid var(--border);
}
.bulk-label { font-size: 12px; color: var(--text-muted); }

/* A listabeli bélyegkép kattintható -- teljes méretben megnyílik */
img.row-thumb { cursor: zoom-in; }
img.row-thumb:hover { outline: 2px solid var(--primary); outline-offset: 1px; }

.image-zoom-dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 92vw;
  max-height: 92vh;
  overflow: visible;
}
.image-zoom-dialog::backdrop { background: rgba(0, 0, 0, 0.8); }
.image-zoom-dialog img {
  display: block;
  max-width: 88vw;
  max-height: 80vh;
  border-radius: 8px;
  background: var(--surface);
}
.image-zoom-close {
  position: absolute;
  top: -14px;
  right: -14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  z-index: 1;
}
.image-zoom-caption {
  margin: 10px 0 0;
  text-align: center;
  color: #fff;
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Statisztika */
#stats-dialog { max-width: 1000px; width: 94vw; }
.stat-section { margin-bottom: 26px; }
.stat-section h3 {
  margin: 0 0 4px;
  font-size: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
/* --- Bevételezés számláról --- */

#invoices-dialog, #invoice-detail-dialog { width: min(940px, 96vw); }

.inv-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 1px solid var(--line, var(--border));
}
.inv-toolbar label { font-size: 13px; color: var(--text-muted); }
.inv-toolbar input[type="date"] {
  padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 14px;
}

.inv-list { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }

.inv-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr 10rem 7rem auto;
  align-items: center; gap: 12px;
  width: 100%; padding: 11px 12px; text-align: left;
  border: 0; border-bottom: 1px solid var(--border); border-radius: 5px;
  background: transparent; color: var(--text); font-size: 14px; cursor: pointer;
}
.inv-row:hover { background: var(--surface-muted); }
.inv-date, .inv-amount { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 13px; }
.inv-amount { text-align: right; }
.inv-supplier { font-weight: 600; }
.inv-number { color: var(--text-muted); font-size: 12.5px; font-family: ui-monospace, Consolas, monospace; }

.inv-rows { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }

.inv-item {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface);
}
.inv-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inv-item-qty { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 13.5px; }
.inv-item-sub { margin-top: 5px; font-size: 12.5px; color: var(--text-muted); }
.inv-item-sub code { font-size: 12px; background: var(--surface-muted); padding: 1px 5px; border-radius: 3px; }

.inv-item-choice {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 13.5px;
}
.inv-item-choice label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.inv-item-product {
  flex: 1 1 260px; min-width: 0; padding: 5px 8px;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--surface); color: var(--text); font-size: 13px;
}
.inv-item-product:disabled { opacity: 0.45; }

.pill.skip { background: var(--surface-muted); color: var(--text-muted); }

@media (max-width: 720px) {
  .inv-row { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .inv-number { grid-column: 1 / -1; }
}

/* --- Jegyzettömb --- */

#notes-dialog { width: min(860px, 94vw); }

.notes-tabs {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 0 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}

.note-tab {
  flex: 0 0 auto;
  max-width: 190px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-tab:hover { background: var(--surface); color: var(--text); }

.note-tab.active {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  margin-bottom: -1px;
  padding-bottom: 9px;
}

.note-tab-new { font-size: 17px; line-height: 1; padding: 7px 12px; }

.notes-body { display: flex; flex-direction: column; gap: 10px; }

.note-title {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text);
}

.note-content {
  min-height: 46vh;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
}

.notes-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.note-status { font-size: 12px; color: var(--text-muted); }

@media (max-width: 700px) {
  .note-content { min-height: 38vh; }
  .notes-tabs { padding: 0 12px; }
}

/* Visszajelzés az űrlapon: mi töltődött ki magától, és mi hiányzik hozzá. */
.field-hint {
  margin: 8px 0 0;
  padding: 7px 10px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface-muted);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
}
.field-hint[hidden] { display: none; }

.stat-note { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; }

/* Az elhagyott tételekről szóló magyarázat -- ne lehessen átsiklani fölötte. */
.stat-warn {
  color: var(--text);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border-left: 3px solid var(--danger);
  border-radius: 4px;
  padding: 8px 12px;
  line-height: 1.5;
}
/* Karakterfelismeréssel olvasott számla. Nem hiba, hanem óvatosságra intés:
   a betűket jól olvassa, az árakat nem mindig. Ezért nem piros, hanem sárga --
   de átsiklani ne lehessen fölötte, mert innen készlet és beszerzési ár lesz. */
.ocr-figyelem {
  color: var(--text);
  background: color-mix(in srgb, #b45309 10%, transparent);
  border-left: 3px solid #b45309;
  border-radius: 4px;
  padding: 10px 12px;
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
}
.ocr-figyelem strong { color: #b45309; }

/* A felismerésből javított ár: a kiolvasott érték áthúzva mellette, hogy
   látszódjon, min változtatott a program. */
.ocr-javitva {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-left: 6px;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.stat-card .stat-value { font-size: 20px; font-weight: 600; display: block; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); }
.stat-card.warn { border-color: #b45309; }
.stat-card.warn .stat-value { color: #b45309; }
.stat-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stat-table th {
  text-align: left;
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.stat-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.stat-table td.szam { text-align: right; font-variant-numeric: tabular-nums; }
.stat-empty { color: var(--text-muted); font-style: italic; padding: 10px 0; }
.stat-two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .stat-two { grid-template-columns: 1fr; } }

/* Frissítés-gomb: csak akkor látszik, ha tényleg van új verzió, ezért
   feltűnőbb a többinél -- de nem harsány, mert ritkán jelenik meg. */
/* A profil-menüben ül, ezért a méretét a .menu-item adja -- itt csak a
   kiemelt szín és a rövid figyelemfelhívó pulzálás. */
.btn-update {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  animation: frissites-figyelem 2.4s ease-in-out 3;
}

/* Külön kell, mert a .menu-item:hover erősebb, mint a .btn-update. */
.menu-item.btn-update:hover { background: var(--primary); filter: brightness(1.12); }
@keyframes frissites-figyelem {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 30%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-update { animation: none; }
}
.btn-update:disabled { opacity: 0.6; cursor: wait; }

/* --- Harang: függőben lévő tennivalók --- */

.btn-bell {
  position: relative;
  padding-right: 12px;
}
.bell-badge {
  display: inline-block;
  min-width: 20px;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

.pending-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.pending-summary span {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  background: var(--surface-muted);
}
.pending-summary b { font-variant-numeric: tabular-nums; }

/* --- Értesítési szabályok listája --- */

.notification-list { display: grid; gap: 10px; }

.notification-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.notification-card.inaktiv { opacity: 0.62; }
.notification-card .n-fo { flex: 1; min-width: 0; }
.notification-card .n-nev { font-weight: 600; }
.notification-card .n-reszlet { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.notification-card .n-gombok { display: flex; gap: 6px; flex-shrink: 0; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}

/* --- Katalógus: csoportosított sor és a kinyíló változatok --- */

.catalog-group-row { cursor: pointer; }
.catalog-group-row:hover { background: var(--surface-muted); }

.catalog-variant-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 12px;
  white-space: nowrap;
}

.catalog-variants td { background: var(--surface-muted); padding: 0; }
.catalog-variants table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}
.catalog-variants th, .catalog-variants td.v {
  padding: 6px 12px;
  font-size: 13px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.catalog-variants tr:last-child td.v { border-bottom: none; }
.catalog-variants .v-olcso { font-weight: 700; }

/* --- Kereszt-beszállítói árkereső --- */

.ar-kartya {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface);
}
.ar-kartya.figyelmeztet { border-left: 3px solid var(--danger); }
.ar-fej { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ar-fej .nev { font-weight: 600; flex: 1 1 auto; min-width: 200px; }
.ar-megtakaritas {
  font-weight: 700;
  white-space: nowrap;
  color: var(--success);
}
.ar-kartya .cikkszam { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.ar-ajanlatok { margin-top: 8px; display: grid; gap: 4px; }
.ar-sor {
  display: flex; align-items: baseline; gap: 10px;
  padding: 4px 8px; border-radius: 5px; font-size: 14px;
}
.ar-sor.legolcsobb { background: var(--surface-muted); font-weight: 700; }
.ar-sor .ar { min-width: 90px; font-variant-numeric: tabular-nums; }
.ar-sor .datum { color: var(--text-muted); font-size: 12px; margin-left: auto; }
.ar-intes {
  margin-top: 8px; font-size: 13px; color: var(--danger);
  display: flex; gap: 6px; align-items: flex-start;
}


/* --- Súgó ---------------------------------------------------------------- */
/* A fülek a párbeszéd tetején maradnak, mert a tartalom hosszú és görgethető. */
.sugo-fulek {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin: 0 0 18px; padding-bottom: 0;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.sugo-ful {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font: inherit; font-size: 14px; font-weight: 600;
  padding: 8px 12px; cursor: pointer; white-space: nowrap;
}
.sugo-ful:hover { color: var(--text); }
.sugo-ful.aktiv { color: var(--primary); border-bottom-color: var(--primary); }

.sugo-lap h3 { font-size: 15px; margin: 22px 0 6px; }
.sugo-lap h3:first-child { margin-top: 0; }
.sugo-lap p { margin: 0 0 10px; line-height: 1.6; }

/* A parancsok kijelölhetők maradjanak: a felhasználó ezeket másolja ki. */
.sugo-parancs {
  font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.5;
  background: var(--surface-muted); border-left: 3px solid var(--border);
  padding: 10px 12px; margin: 8px 0 10px; overflow-x: auto; white-space: pre-wrap;
  word-break: break-all; user-select: all;
}
.sugo-gond { border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; margin-bottom: 10px; }
.sugo-gond .tunet { font-weight: 650; margin: 0 0 4px; }

/* --- Kuka: tömeges kijelölés ---------------------------------------------- */
/* Az eszköztár a lista fölött marad, mert több ezer tételnél a görgetés alján
   már senki nem találná meg. */
.kuka-eszkoztar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 8px;
  background: var(--surface-muted); border: 1px solid var(--border); border-radius: 6px;
}
.kuka-mind { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.kuka-kijelolve { font-size: 13px; color: var(--text-muted); flex: 1; }
.trash-item .kuka-jelolo { margin-right: 10px; flex: none; }

/* --- Beszállítói árlisták (több is lehet) --------------------------------- */
.arlista-lista { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.arlista-sor {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; background: var(--surface-muted);
  border: 1px solid var(--border); border-radius: 6px;
}
/* A fájlnév nyúljon, de ne tolja szét a sort: hosszú neveknél levágjuk. */
.arlista-nev {
  flex: 1 1 auto; min-width: 0; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.arlista-marka { flex: 0 0 160px; font-size: 13px; padding: 4px 8px; }
.arlista-torol { flex: none; }
@media (max-width: 560px) {
  .arlista-sor { flex-wrap: wrap; }
  .arlista-marka { flex: 1 1 100%; }
}

/* --- Raktár-lapfülek ------------------------------------------------------ */
/* A fülek a terméklista fölött ülnek. Sok raktárnál vízszintesen görgethetők,
   de a lista maga soha nem csúszik el oldalra. */
.raktar-sav {
  display: flex; align-items: flex-end; gap: 12px;
  border-bottom: 2px solid var(--border); margin-bottom: 12px;
}
.raktar-fulek { display: flex; gap: 2px; flex: 1 1 auto; overflow-x: auto; }
.raktar-ful {
  background: none; border: none; border-bottom: 3px solid transparent;
  color: var(--text-muted); font: inherit; font-size: 14px; font-weight: 600;
  padding: 9px 14px; cursor: pointer; white-space: nowrap;
}
.raktar-ful:hover { color: var(--text); }
.raktar-ful.aktiv { color: var(--primary); border-bottom-color: var(--primary); }
.raktar-ful .raktar-db {
  font-weight: 400; font-size: 12px; color: var(--text-muted); margin-left: 6px;
}
.raktar-muveletek { display: flex; gap: 6px; padding-bottom: 6px; flex: none; }

/* A kiválasztott raktár adatai egy sorban, a lista fölött. */
.raktar-fej {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: 13px; color: var(--text-muted);
  padding: 0 2px 12px;
}
.raktar-fej b { color: var(--text); font-weight: 600; }
@media (max-width: 620px) {
  .raktar-sav { flex-direction: column; align-items: stretch; gap: 6px; }
  .raktar-muveletek { justify-content: flex-end; padding-bottom: 8px; }
}

/* ===========================================================================
   NYOMTATÁS
   ===========================================================================

   A képernyő és a papír két különböző műfaj. A képernyőn szűrők, gombok,
   lapozó és menü van; a papíron ezek mind szemetet jelentenek. Ezért nem a
   képernyőt nyomtatjuk, hanem a #nyomtatvány dobozba építünk egy külön
   dokumentumot, és nyomtatáskor csak az látszik.

   Képernyőn a doboz rejtve van, tehát a felületet nem zavarja. */

#nyomtatvany { display: none; }

@media print {
  /* Minden más eltűnik -- a nyitott felugró ablakok is, mert azokból a
     böngésző egy fekete hátteret nyomtatna a lap tetejére. */
  body > *:not(#nyomtatvany) { display: none !important; }
  dialog[open] { display: none !important; }

  #nyomtatvany {
    display: block;
    background: #fff;
    color: #000;
    font: 11pt/1.4 "Segoe UI", system-ui, sans-serif;
  }

  /* Fehér papír, fekete tinta -- a sötét mód a képernyőé. */
  html, body {
    background: #fff !important;
    color: #000 !important;
    margin: 0;
    padding: 0;
  }

  @page { margin: 14mm 12mm; }

  /* --- Fejléc: kitől jön az irat ---------------------------------------- */
  .ny-fej {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 20px; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 14px;
  }
  .ny-ceg { font-size: 10pt; line-height: 1.35; }
  .ny-ceg b { font-size: 12pt; display: block; margin-bottom: 2px; }
  .ny-kelt { font-size: 9.5pt; text-align: right; white-space: nowrap; }

  .ny-cim { font-size: 16pt; font-weight: 700; margin: 0 0 2px; }
  .ny-alcim { font-size: 10pt; color: #333; margin: 0 0 14px; }

  /* --- Táblázat ---------------------------------------------------------- */
  .ny-tabla { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  .ny-tabla th {
    text-align: left; border-bottom: 1.5px solid #000; padding: 5px 6px;
    font-size: 8.5pt; text-transform: uppercase; letter-spacing: 0.04em;
  }
  .ny-tabla td { padding: 4px 6px; border-bottom: 1px solid #ccc; vertical-align: top; }
  .ny-tabla .sz { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

  /* A fejléc minden lap tetején ismétlődjön, különben a második oldaltól
     nem lehet tudni, melyik oszlop micsoda. */
  .ny-tabla thead { display: table-header-group; }
  .ny-tabla tr { page-break-inside: avoid; }

  /* Leltárívnél kézzel kitöltendő rubrika. */
  .ny-tabla .ures { border-bottom: 1px solid #000; min-width: 70px; }

  /* --- Összegzés és lábjegyzet ------------------------------------------ */
  .ny-osszeg {
    margin-top: 12px; text-align: right; font-size: 11pt;
    border-top: 2px solid #000; padding-top: 8px;
  }
  .ny-osszeg b { font-size: 13pt; }
  .ny-megjegyzes { margin-top: 14px; font-size: 9.5pt; white-space: pre-wrap; }
  .ny-lab {
    margin-top: 22px; padding-top: 8px; border-top: 1px solid #999;
    font-size: 8.5pt; color: #444;
  }
  .ny-alairas {
    margin-top: 34px; display: flex; justify-content: space-between; gap: 40px;
    font-size: 9pt; page-break-inside: avoid;
  }
  .ny-alairas div { flex: 1; border-top: 1px solid #000; padding-top: 5px; text-align: center; }

  .ny-adatpar { font-size: 10pt; margin: 0 0 3px; }
  .ny-adatpar b { display: inline-block; min-width: 130px; }
}

/* A menüpont melletti szám: hány szkennelés vár átnézésre. Ugyanaz a
   formanyelv, mint a fejlécbeli harangé. */
.menu-badge {
  display: inline-block;
  margin-left: 8px;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 16px;
}

/* A terméklista sorvégi gombjai egymás mellett, ne törjenek külön sorba. */
.sor-muveletek { white-space: nowrap; }
.sor-muveletek .btn-icon + .btn-icon { margin-left: 2px; }
