:root {
  /* Márkaszínek – autofelszerelesek.hu */
  --accent: #007dbc;
  --accent-dark: #00669b;
  --accent-soft: #e6f3fa;
  --accent-2: #faeb46; /* másodlagos (sárga) */
  --green: #23a942;
  --red: #ff5d5d;

  /* Világos, letisztult téma */
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: #e7ebf0;
  --border-strong: #d9dee6;
  --text: #1a2330;
  --muted: #6b7686;
  --muted-2: #9aa4b2;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-pop: 0 10px 30px rgba(16, 24, 40, 0.12);
}

/* Termékek: friss/cache jelzősáv */
.freshbar {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px; padding: 9px 14px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  border: 1px solid var(--border-strong); background: var(--panel);
}
.freshbar.hidden { display: none; }
.freshbar .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: var(--muted-2); }
.freshbar.fresh { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.freshbar.fresh .dot { background: #17b26a; }
.freshbar.saved { background: var(--accent-soft); border-color: #b2d9ee; color: var(--accent-dark); }
.freshbar.saved .dot { background: var(--accent); }
.freshbar.update { background: #fef6ee; border-color: #f9b97a; color: #b54708; }
.freshbar.update .dot { background: #f79009; animation: freshpulse 1s ease-in-out infinite; }
.freshbtn { margin-left: auto; padding: 6px 14px; border-radius: 8px; border: none; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; cursor: pointer; }
.freshbtn:hover { background: var(--accent-dark); }
.freshbtn.ghost { background: transparent; color: var(--accent-dark); border: 1px solid currentColor; font-weight: 600; }
.freshbtn.ghost:hover { background: rgba(0,0,0,.04); }
.freshbar.building, .freshbar.initial { background: #fffaeb; border-color: #fedf89; color: #b54708; }
.freshbar.building .dot, .freshbar.initial .dot { background: #f79009; animation: freshpulse 1s ease-in-out infinite; }
@keyframes freshpulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }

/* Felső figyelmeztető sor (UNAS + Termékek fül) — középre */
.refresh-note { text-align: center; margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius-sm); background: #fff8f0; border: 1px solid #fed7aa; }
.refresh-note .rn-main { font-weight: 700; font-size: 14px; color: #b54708; }
.refresh-note .rn-sub { margin-top: 3px; font-size: 12px; color: var(--muted); }

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Barlow", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

a { color: var(--accent); text-decoration: none; }

/* ---------- Topbar / szűrők ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 14px 24px; flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 -3px 0 var(--accent); /* akcentszínű elválasztó csík (kék UNAS / piros THARANIS) */
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 17px; letter-spacing: -0.01em;
}
/* A lapnév + verzió egymás ALATT, balra igazítva (a dot mellett). */
.brand-text { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
/* Fix szélesség a (változó hosszúságú) lapnévnek -> a fülek (Megrendelések|Termékek|…)
   NEM ugrálnak lapváltáskor. A leghosszabb név: „Megrendelések – Összesítő". */
#brandTitle { display: inline-block; min-width: 235px; }
.brand-ver { font-size: 10px; font-weight: 600; color: var(--muted-2); letter-spacing: .06em; margin-top: 1px; }
.hidden { display: none !important; }
.loading-flag {
  font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: .02em;
  animation: blink 1s ease-in-out infinite;
  /* MINDIG foglaljon helyet (fix szélesség) -> megjelenéskor NEM ugranak a fülek.
     Csak a láthatóságot kapcsolgatjuk, a layout-ot nem. */
  display: inline-block; min-width: 64px; white-space: nowrap; visibility: hidden;
}
.loading-flag.on { visibility: visible; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
.daterange { display: inline-flex; align-items: center; gap: 6px; }
.daterange input[type="date"] { padding: 8px 10px; color: var(--text); }
.daterange .dash { color: var(--muted); }

.brand .dot {
  width: 12px; height: 12px; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 0 0 4px var(--accent-soft);
}
/* A szűrősor MINDIG teljes szélességű külön sor (a userbar így stabilan a jobb
   felső sarokban marad, a szűrők egy sorral lejjebb — fül-/lapváltáskor sem ugrál). */
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex-basis: 100%; width: 100%; margin-top: 2px; }
.filters-group { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Fülek */
.tabs { display: inline-flex; gap: 4px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.tab { background: transparent; border: none; padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); border-color: transparent; }
.tab.active { background: var(--accent); color: #fff; }

/* THARANIS = piros téma (egyértelmű, hogy melyik rendszerben vagyunk) */
body.theme-tharanis {
  --accent: #e02424;
  --accent-dark: #b91c1c;
  --accent-soft: #fde8e8;
}
body.theme-tharanis { background: #fdf3f3; } /* finom piros árnyalat az egész oldalon */

/* Termékek = zöld téma */
body.theme-products {
  --accent: #1f9d57;
  --accent-dark: #157a42;
  --accent-soft: #e6f6ec;
}
body.theme-products { background: #f2faf5; }

/* Pénzügy = piros téma */
body.theme-finance {
  --accent: #e02424;
  --accent-dark: #b91c1c;
  --accent-soft: #fde8e8;
}
body.theme-finance { background: #fdf3f3; }

/* Beszerzés = fekete téma */
body.theme-procurement {
  --accent: #111827;
  --accent-dark: #000000;
  --accent-soft: #e5e7eb;
}
body.theme-procurement { background: #f6f7f8; }

/* ===== Személyes háttérszín (Profil) — a tab-téma tinteket is felülírja ===== */
body.userbg { background: var(--userbg) !important; }

/* ===== Sötét téma (Profil → 🌙 Sötét) — a fő felületekre kiterjesztett változó-override ===== */
body.theme-dark {
  --bg: #10151f; --panel: #1a2230; --panel-2: #222c3d;
  --border: #2c3648; --border-strong: #3a475d;
  --text: #e6eaf1; --muted: #9aa6b8; --muted-2: #6c7889;
  --accent-soft: #16324a;
  --shadow: 0 1px 3px rgba(0,0,0,.5); --shadow-pop: 0 12px 30px rgba(0,0,0,.6);
  background: var(--bg) !important; color: var(--text);
}
body.theme-dark .card, body.theme-dark .kpi, body.theme-dark .drawer, body.theme-dark .bk-form,
body.theme-dark .table-wrap, body.theme-dark .crm-list, body.theme-dark .cs-list, body.theme-dark .msg-list,
body.theme-dark .ms-panel, body.theme-dark .rem-item, body.theme-dark .rem-form, body.theme-dark .cs-item,
body.theme-dark .cs-kpi-tile, body.theme-dark .perm-group, body.theme-dark .pa-keywords, body.theme-dark .cs-edit,
body.theme-dark input, body.theme-dark select, body.theme-dark textarea,
body.theme-dark .ms .ms-btn, body.theme-dark .fp-bar .fp-select, body.theme-dark .cs-select, body.theme-dark .fp-btn {
  background: var(--panel); color: var(--text); border-color: var(--border);
}
body.theme-dark table th { background: var(--panel-2); color: var(--muted); }
body.theme-dark table td { border-color: var(--border); }
body.theme-dark tbody tr:hover td { background: var(--panel-2); }
body.theme-dark .top-scroll { filter: invert(0.9) hue-rotate(180deg); }
body.theme-dark .kpi-pop, body.theme-dark .crm-mention-pop { background: var(--panel); color: var(--text); border-color: var(--border); }
body.theme-dark .muted, body.theme-dark .muted-2 { color: var(--muted); }

/* Profil színválasztó */
.pf-theme { margin-bottom: 14px; }
.pf-theme-label { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.pf-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-sw { width: 34px; height: 34px; border-radius: 9px; border: 2px solid var(--border, #e4e8ee); cursor: pointer; padding: 0; font-size: 12px; line-height: 1; }
.pf-sw.pf-default { width: auto; padding: 0 10px; background: var(--panel, #fff); color: var(--muted, #6b7280); font-weight: 600; }
.pf-sw.pf-dark { width: auto; padding: 0 10px; background: #10151f; color: #e6eaf1; font-weight: 600; }
.pf-sw.active { border-color: var(--accent, #007dbc); box-shadow: 0 0 0 2px var(--accent, #007dbc); }
.pf-sw:hover { transform: translateY(-1px); }

select, input, button {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 9px 12px; outline: none;
  accent-color: var(--accent); /* natív legördülő/checkbox kiemelés a téma színével (nem a böngésző kékje) */
  transition: border-color .15s, box-shadow .15s, background .15s;
}
/* A kijelölt szöveg és a natív vezérlők is a témát kövessék (Beszerzés=fekete, Pénzügy=piros) */
body { accent-color: var(--accent); }
::selection { background: var(--accent); color: #fff; }
/* Legördülő (select) popup: a kiválasztott elem a téma színével (nem a böngésző kékjével).
   Chrome a popupban az option:checked háttérre hallgat; az accent-color a kiegészítő. */
select option { background: var(--panel); color: var(--text); }
select option:checked { background: var(--accent); color: #fff; }

/* Beszerzés-részletek: HÚZHATÓ szélességű terméknév-oszlop (--proc-name-w), a hosszú nevek
   levágva (…), teljes név tooltipben. A fejléc jobb szélén egy húzó-fogantyú. */
:root { --proc-name-w: 220px; }
.proc-items td.proc-name, .proc-items th.proc-name {
  width: var(--proc-name-w, 220px); max-width: var(--proc-name-w, 220px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.proc-items th.proc-name { position: relative; }
.proc-items th.proc-name .col-resize {
  position: absolute; top: 0; right: 0; width: 8px; height: 100%;
  cursor: col-resize; user-select: none;
}
.proc-items th.proc-name .col-resize:hover { background: var(--accent, #007dbc); opacity: .4; }
select { cursor: pointer; padding-right: 30px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7686' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#search { min-width: 260px; }
input::placeholder { color: var(--muted-2); }

button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button.ghost { background: transparent; border-color: var(--border-strong); color: var(--muted); }
button.ghost:hover { color: var(--text); border-color: var(--border-strong); background: var(--panel-2); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; padding: 0; height: 38px; font-size: 16px; }

/* Multi-select legördülő */
.ms { position: relative; }
.ms-btn {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 14px; color: var(--text); cursor: pointer;
}
.ms-btn:hover { border-color: var(--accent); }
.ms.active .ms-btn { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.ms-caret { color: var(--muted); font-size: 10px; }
.ms-panel {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; max-height: 320px; overflow: auto;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: var(--shadow-pop); padding: 6px; z-index: 40;
}
.ms-panel.hidden { display: none; }
.ms-tools { display: flex; gap: 6px; padding: 4px 4px 6px; }
.ms-tools button { flex: 1; padding: 6px 8px; font-size: 12px; border-radius: 8px; background: var(--panel-2); border-color: var(--border); color: var(--muted); }
.ms-tools button:hover { color: var(--text); border-color: var(--accent); }
.ms-opt { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.ms-opt:hover { background: var(--accent-soft); }
.ms-opt input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex: none; }
.ms-opt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-empty { padding: 10px; color: var(--muted); font-size: 13px; }

/* ---------- Main ---------- */
main { padding: 22px 24px 40px; max-width: min(2100px, 98vw); margin: 0 auto; }

section + section { margin-top: 22px; }

/* ---------- KPI kártyák ---------- */
.kpis {
  display: grid; gap: 14px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.pos { color: var(--green); }
.neg { color: var(--red); }

.kpi.clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.kpi.clickable:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Szűrő checkbox */
.chk { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--panel); font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.chk:hover { border-color: var(--accent); }

/* Súly/méret pótdíj jelző a táblában */
.ws-badge { display: inline-block; margin-left: 4px; cursor: help; filter: saturate(1.3); }

/* GLS költség bontás */
.card.bd { padding: 14px 16px; }
.bd-row { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.bd-row:last-child { border-bottom: none; }
.bd-row span:first-child { color: var(--muted); }
.bd-row.subtotal { font-weight: 600; border-top: 1px solid var(--border); margin-top: 4px; }
.bd-row.subtotal span:first-child { color: var(--text); }
.bd-row.total { font-weight: 700; font-size: 15px; }
.bd-row.total span:first-child { color: var(--text); }
.bd-row.ws { background: #fff8e1; margin: 2px -8px; padding: 8px; border-radius: 8px; border: 1px solid #ffe08a; border-bottom: 1px solid #ffe08a; }
.bd-row.ws span { color: #8a6d00 !important; font-weight: 600; }
.kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.kpi .kpi-label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .kpi-val { font-size: 24px; font-weight: 600; margin-top: 6px; letter-spacing: -0.01em; }
.kpi .kpi-sub { color: var(--muted-2); font-size: 12px; margin-top: 2px; }
.kpi .kpi-cut { color: #92610a; background: #fff8e6; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; letter-spacing: 0; text-transform: none; white-space: nowrap; cursor: help; }
.kpi.accent { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); border-color: transparent; color: #fff; }
.kpi.accent .kpi-label { color: rgba(255,255,255,.85); }
.kpi.accent .kpi-sub { color: rgba(255,255,255,.8); }

/* ---------- Napi kiadási teljesítmény (fulfillment) ---------- */
.fulfill-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.fulfill-head strong { font-size: 14px; }
.fulfill-day { font-size: 12px; color: var(--muted); font-weight: 600; }
.fulfill-grid { display: grid; gap: 12px; grid-template-columns: 1.2fr repeat(4, minmax(0, 1fr)); align-items: stretch; }
@media (max-width: 980px) { .fulfill-grid { grid-template-columns: 1fr 1fr; } }
.fulfill-main { border-radius: var(--radius); padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #fff; box-shadow: var(--shadow); }
.fulfill-rate { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.fulfill-band { font-size: 42px; line-height: 1; flex: 0 0 auto; }
.fulfill-main.band-poor { background: linear-gradient(135deg, #e5484d, #b42318); }
.fulfill-main.band-normal { background: linear-gradient(135deg, #30a46c, #177245); }
.fulfill-main.band-excellent { background: linear-gradient(135deg, #f5b301, #e08a00); }
.fulfill-main.band-none { background: linear-gradient(135deg, #8b93a1, #5b6472); }
.fulfill-pickup .kpi-sub { line-height: 1.7; font-size: 12px; color: var(--muted); margin-top: 6px; }
.fulfill-note { margin-top: 14px; padding: 12px 14px; border: 1px solid #f1c0c0; background: #fdf2f2; border-radius: var(--radius); }
.fulfill-note label { display: block; font-size: 12.5px; font-weight: 600; color: #b42318; margin-bottom: 6px; }
.fulfill-note textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font: inherit; resize: vertical; }
.fulfill-note-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.fulfill-note-row button { padding: 5px 14px; border: none; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; font: inherit; }
.fulfill-note-meta { font-size: 11.5px; color: var(--muted); }
.fulfill-note-hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
/* Napi zárási teljesítmény diagram(ok) — auto-fit: asztalon egymás mellé, mobilon egymás alá */
.fulfill-charts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); margin: 0 0 12px; }
.fulfill-chart-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.fulfill-chart-title { font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.fulfill-chart-empty { color: var(--muted); font-size: 13px; padding: 22px 0; text-align: center; }
/* div-alapú oszlopdiagram: az oszlopok kitöltik a szélességet (flex), fix magasság → reszponzív */
.fdc { display: flex; gap: 8px; }
.fdc-yaxis { display: flex; flex-direction: column; justify-content: space-between; height: 180px; font-size: 9px; color: var(--muted); text-align: right; flex: 0 0 auto; }
.fdc-main { flex: 1; min-width: 0; }
.fdc-plot { position: relative; height: 180px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--border);
  background-image: repeating-linear-gradient(to top, transparent 0, transparent calc(20% - 1px), #eef0f2 calc(20% - 1px), #eef0f2 20%); }
.fdc-threshold { position: absolute; left: 0; right: 0; bottom: 80%; border-top: 1px dashed #e5484d; opacity: .45; pointer-events: none; }
.fdc-col { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.fdc-bar { width: 100%; border-radius: 2px 2px 0 0; min-height: 1px; }
.fdc-bar.band-poor { background: #d64545; }
.fdc-bar.band-normal { background: #2f9e63; }
.fdc-bar.band-excellent { background: #e0a200; }
.fdc-bar.band-none { background: #9aa3af; }
.fdc-bar.band-pickup { background: #d9a400; }
.fdc-days { display: flex; gap: 2px; margin-top: 3px; }
.fdc-day { flex: 1 1 0; text-align: center; font-size: 8px; color: var(--muted); min-width: 0; overflow: hidden; }
.fulfill-last { margin-top: 10px; font-size: 12px; color: var(--muted); }
/* Kattintható számok (drill-down az Összesítő táblára) */
.fulfill-click { cursor: pointer; }
.fulfill-click:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.fulfill-split { margin-top: 4px; }
.fulfill-split .fx { cursor: pointer; font-weight: 600; }
.fulfill-split .fx:hover { text-decoration: underline; }
.fulfill-split .fx.carried { color: #b45309; }
.fulfill-split .fx.new { color: #0c7a43; }
/* Aktív drill-szűrő chip */
.fulfill-drill { margin: 10px 0 2px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3; padding: 6px 10px; border-radius: 8px; }
.fulfill-drill button { margin-left: auto; border: none; background: #c7d2fe; color: #3730a3; border-radius: 6px; padding: 2px 9px; cursor: pointer; font: inherit; font-weight: 600; }
/* Lezárás gomb + állapot */
.fulfill-actions { margin-top: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fulfill-close-btn { padding: 8px 16px; border: none; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; font: inherit; font-weight: 600; }
.fulfill-close-btn:hover { filter: brightness(1.05); }
.fulfill-close-btn:disabled { opacity: .55; cursor: default; }
.fulfill-closed-info { font-size: 12.5px; color: var(--muted); }
/* Lezárás-eredmény sáv */
.fulfill-result { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); font-size: 14px; font-weight: 600; }
.fulfill-result.band-poor { background: #fdf2f2; border: 1px solid #f1c0c0; color: #b42318; }
.fulfill-result.band-normal { background: #eafaf1; border: 1px solid #b7e4c7; color: #177245; }
.fulfill-result.band-excellent { background: #fff8e6; border: 1px solid #f5d98b; color: #92610a; }

/* ---------- Belső üzenetek (ÜZENETEK, a Feladatok fülön belül) ---------- */
.crm-subtabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.crm-subtab { border: none; background: transparent; padding: 9px 15px; cursor: pointer; font: inherit; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 7px; }
.crm-subtab.active { color: var(--accent); border-bottom-color: var(--accent); }
.msg-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.msg-toolbar input[type=search] { flex: 1; min-width: 160px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.msg-list { display: flex; flex-direction: column; gap: 8px; }
.msg-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); cursor: pointer; }
.msg-item:hover { border-color: var(--accent); }
.msg-item.unread { background: #f0f7ff; border-color: #bcdcff; }
.msg-item.sys { background: #fffbea; border-color: #f5e08a; }
.msg-ava { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; text-transform: uppercase; }
.msg-item.sys .msg-ava { background: #d9a400; }
.msg-main { flex: 1; min-width: 0; }
.msg-row1 { display: flex; align-items: baseline; gap: 8px; }
.msg-from { font-weight: 700; }
.msg-subject { font-weight: 600; }
.msg-time { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.msg-snippet, .msg-to { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-snippet { color: var(--muted); font-size: 13px; margin-top: 2px; }
.msg-to { font-size: 11.5px; color: var(--muted-2); margin-top: 3px; }
.msg-empty { color: var(--muted); padding: 26px; text-align: center; }
/* Szerkesztő + szál a drawerben */
.msg-form { display: flex; flex-direction: column; gap: 10px; }
.msg-form h3 { margin: 0 0 4px; }
.msg-form label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.msg-recipients { display: flex; flex-wrap: wrap; gap: 6px 14px; max-height: 170px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; }
.msg-recipients label { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; color: var(--text); }
.msg-form input[type=text], .msg-form textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font: inherit; }
.msg-form textarea { resize: vertical; min-height: 120px; }
.msg-thread { display: flex; flex-direction: column; gap: 10px; }
.msg-bubble { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fafafa; }
.msg-bubble.mine { background: #eef6ff; border-color: #cfe4fb; }
.msg-bubble.sys { background: #fffbea; border-color: #f5e08a; }
.msg-bubble .b-head { font-size: 12px; color: var(--muted); margin-bottom: 5px; display: flex; gap: 8px; flex-wrap: wrap; }
.msg-bubble .b-body { white-space: pre-wrap; word-break: break-word; }
.msg-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 2px; }
.msg-actions button { padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); cursor: pointer; font: inherit; }
.msg-actions button.primary { background: var(--accent); color: #fff; border-color: transparent; }
.msg-actions button.danger { color: #b42318; border-color: #f1c0c0; }

/* ---------- Ügyfélszolgálat / Megkeresések ---------- */
.cs-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cs-toolbar input[type=search] { flex: 1; min-width: 200px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.cs-select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--panel); }
.cs-meta { font-size: 12px; color: var(--muted); }
.cs-list { display: flex; flex-direction: column; gap: 8px; }
.cs-item { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); cursor: pointer; }
.cs-item:hover { border-color: var(--accent); }
.cs-row1 { display: flex; align-items: center; gap: 8px; }
.cs-name { font-weight: 700; }
.cs-ts { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.cs-snippet { color: var(--text); font-size: 13px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-meta2 { font-size: 11.5px; color: var(--muted-2); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.cs-badge.order { background: #e6f1fb; color: #0c447c; }
.cs-badge.inquiry { background: #eafaf1; color: #177245; }
/* Napi ügyfélszolgálati feldolgozási KPI (a csomagfeldolgozás mintájára) */
.cs-kpi { margin: 0 0 14px; }
.cs-kpi-head { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.cs-kpi-body { display: grid; grid-template-columns: minmax(170px, 240px) 1fr; gap: 12px; align-items: stretch; }
.cs-kpi-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 22px; border-radius: 12px; color: #fff; }
.cs-kpi-main.band-none { background: #9ca3af; }
.cs-kpi-main.band-poor { background: linear-gradient(135deg,#e11d48,#f43f5e); }
.cs-kpi-main.band-normal { background: linear-gradient(135deg,#16a34a,#22c55e); }
.cs-kpi-main.band-excellent { background: linear-gradient(135deg,#7c3aed,#a855f7); }
.cs-kpi-rate { font-size: 34px; font-weight: 800; line-height: 1; }
.cs-kpi-emoji { font-size: 30px; }
.cs-kpi-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.cs-kpi-tile { border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 10px 12px; background: var(--panel, #fff); }
.cs-kpi-tile .l { font-size: 12px; color: var(--muted, #6b7280); font-weight: 600; }
.cs-kpi-tile .v { font-size: 20px; font-weight: 700; margin: 2px 0; }
.cs-kpi-tile .s { font-size: 11px; color: var(--muted-2, #9ca3af); }
@media (max-width: 640px) { .cs-kpi-body { grid-template-columns: 1fr; } }
/* Üzenet/Riasztás típus-váltó a composerben */
.msg-type { display: inline-flex; gap: 0; border: 1px solid var(--border, #d1d5db); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.msg-type .mt-opt { padding: 8px 16px; border: none; background: var(--panel, #fff); color: var(--muted, #6b7280); font: inherit; font-weight: 600; cursor: pointer; }
.msg-type .mt-opt.active { background: var(--accent, #007dbc); color: #fff; }
.msg-remfields { display: flex; flex-wrap: wrap; gap: 12px; margin: 4px 0 10px; padding: 10px 12px; background: #fdecec; border: 1px solid #f3c2c2; border-radius: 10px; }
.msg-remfields.hidden { display: none; }
.msg-remfields label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: #b42318; }
.msg-remfields input, .msg-remfields select { padding: 7px 9px; border: 1px solid var(--border, #d1d5db); border-radius: 8px; font: inherit; }
/* Időzített riasztások (CRM al-fül) */
.rem-form { border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 12px 14px; margin: 4px 0 14px; background: #fafbfc; }
.rem-form textarea { width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--border, #d1d5db); border-radius: 8px; font: inherit; resize: vertical; }
.rem-form-fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 8px; }
.rem-f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted, #6b7280); font-weight: 600; }
.rem-f input, .rem-f select { padding: 7px 9px; border: 1px solid var(--border, #d1d5db); border-radius: 8px; font: inherit; }
.rem-list { display: flex; flex-direction: column; gap: 8px; }
.rem-item { display: flex; align-items: center; gap: 10px; justify-content: space-between; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; padding: 10px 12px; background: var(--panel, #fff); }
.rem-item.is-fired { opacity: .62; }
.rem-item-text { font-weight: 600; font-size: 14px; }
.rem-item-meta { font-size: 12px; color: var(--muted, #6b7280); margin-top: 2px; }
.rem-item-right { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.rem-badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.rem-badge.due { background: #fdecec; color: #b42318; }
.rem-badge.fired { background: #eef2f7; color: #6b7280; }
.rem-del { border: none; background: none; cursor: pointer; font-size: 15px; opacity: .7; }
.rem-del:hover { opacity: 1; }
.rem-tasklink { color: #0c447c; cursor: pointer; text-decoration: none; }
.rem-tasklink:hover { text-decoration: underline; }
.cs-status { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #eef0f2; color: var(--muted); white-space: nowrap; }
.cs-status.done { background: #eafaf1; color: #177245; }
.cs-status.prog { background: #e6f1fb; color: #0c447c; }
.cs-status.warn { background: #fdf2f2; color: #b42318; }
.cs-status.hand { background: #fff8e6; color: #92610a; }
.cs-status.new { background: #f3e8ff; color: #6b21a8; }
.cs-edit { margin-top: 14px; padding: 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; background: #fafbfc; }
.cs-edit-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cs-edit-row .cs-el { flex: 0 0 90px; font-size: 12px; font-weight: 600; color: var(--muted); }
.cs-edit-row .cs-ei { flex: 1; padding: 7px 10px; border: 1px solid var(--border, #d1d5db); border-radius: 8px; font-size: 13px; }
.cs-edit-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.cs-save-msg { font-size: 12px; font-weight: 600; }
.cs-save-msg.ok { color: #177245; }
.cs-save-msg.err { color: #b42318; }
.cs-notes-wrap { margin-top: 16px; }
.cs-notes-h { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.cs-notes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.cs-note { background: #f6f8fa; border-radius: 8px; padding: 8px 10px; }
.cs-note-h { margin-bottom: 2px; }
.cs-note-t { font-size: 13px; line-height: 1.4; }
.cs-commentbox { display: flex; gap: 8px; align-items: flex-end; position: relative; }
.cs-commentbox textarea { flex: 1; padding: 8px 10px; border: 1px solid var(--border, #d1d5db); border-radius: 8px; font: inherit; resize: vertical; }
.cs-orderlink { color: #0c447c; font-weight: 600; cursor: pointer; text-decoration: none; }
.cs-orderlink:hover { text-decoration: underline; }
/* Beszállítói árváltozás-figyelő */
.pa-keywords { margin: 10px 0 12px; padding: 10px 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; background: #fafbfc; }
.pa-kw-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pa-kw { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 4px 3px 10px; border-radius: 999px; background: #eef2ff; color: #3730a3; }
.pa-kw.pa-ex { background: #fdecec; color: #b42318; }
.crm-actions .danger { background: #fdecec; color: #b42318; border: 1px solid #f3c2c2; }
.crm-actions .danger:hover { background: #f9d5d5; }
/* Mentett szűrők sáv */
.fp-bar { display: inline-flex; align-items: center; gap: 6px; }
.fp-bar .fp-select { font-size: 12px; padding: 5px 8px; border: 1px solid var(--border, #d1d5db); border-radius: 8px; background: var(--panel, #fff); max-width: 220px; }
.fp-btn { font-size: 12px; padding: 5px 9px; border: 1px solid var(--border, #d1d5db); border-radius: 8px; background: var(--panel, #fff); cursor: pointer; white-space: nowrap; }
.fp-btn:hover:not(:disabled) { background: #f3f4f6; }
.fp-btn:disabled { opacity: .45; cursor: default; }
.fp-users { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; max-height: 320px; overflow: auto; }
.fp-user { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 4px 2px; }
/* Beszerzés: a lenyitott sor kiemelése + forgó nyíl */
/* Összesítő: a Forrás/kampány oszlop szélesség-korlátja (ne nyúljon irrelevánsan szélesre) */
#smTable th.sm-src, #smTable td.sm-src { max-width: 180px; }
#smTable td.sm-src > span, #smTable td.sm-src .muted { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proc-caret { display: inline-block; transition: transform .15s ease; color: var(--muted, #6b7280); }
tr.proc-row.proc-open .proc-caret { transform: rotate(90deg); color: var(--accent, #007dbc); }
tr.proc-row.proc-open > td { background: #bcdcf3; }
tr.proc-row.proc-open > td:first-child { box-shadow: inset 3px 0 0 var(--accent, #007dbc); font-weight: 600; }
tr.proc-detail.proc-open > td { box-shadow: inset 3px 0 0 var(--accent, #007dbc); }
.pa-kw-x { border: none; background: none; color: inherit; font-size: 15px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 50%; }
.pa-kw-x:hover { background: rgba(0,0,0,.08); }
.pa-kw-add { display: flex; gap: 8px; }
.pa-kw-add input { flex: 1; padding: 7px 10px; border: 1px solid var(--border, #d1d5db); border-radius: 8px; font-size: 13px; }
.pa-kw-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: #eef2ff; color: #3730a3; margin-right: 4px; }
.pa-kw-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.pa-att { color: var(--muted); font-size: 12px; margin-left: 6px; }
.pa-atts { display: flex; flex-direction: column; gap: 6px; }
.pa-att-link { color: #0c447c; text-decoration: none; font-weight: 600; }
.pa-att-link:hover { text-decoration: underline; }
.pa-body-h { font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
.pa-body { font-size: 13px; line-height: 1.5; white-space: normal; max-height: 340px; overflow: auto; padding: 10px 12px; background: #f6f8fa; border-radius: 8px; word-break: break-word; }
.pa-status-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.cs-empty { color: var(--muted); padding: 26px; text-align: center; }
.cs-detail h3 { margin: 0 0 10px; }
.cs-f { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.cs-fk { flex: 0 0 130px; font-size: 12px; font-weight: 600; color: var(--muted); }
.cs-fv { flex: 1; word-break: break-word; }
.cs-note { margin-top: 12px; font-size: 12px; color: var(--muted); background: #f6f8fa; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }

/* ---------- Diagramok ---------- */
.charts { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.card > h3 {
  margin: 0 0 14px; font-size: 13px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.chart-wide { grid-column: 1 / -1; }
.canvas-wrap { position: relative; height: 280px; }
.canvas-wrap.sm { height: 240px; }

/* ---------- Adat szekció / táblázat ---------- */
.data-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.data-head h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.summary { display: flex; gap: 20px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.summary strong { color: var(--text); font-weight: 600; }

.status { margin: 8px 0; color: var(--muted); }
.err-box {
  background: #fff1f1; color: #c0392b; border: 1px solid #ffd5d5;
  padding: 10px 14px; border-radius: var(--radius-sm); display: inline-block;
}

/* A tábla saját függőleges görgetőablakot kap (max-height), hogy a thead
   position:sticky-vel a tetején maradhasson görgetéskor. (Lapszintű görgetésnél
   az overflow-x:auto miatt a thead amúgy elcsúszna — lásd lentebb a sticky thead.) */
.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 140px); }
table { width: 100%; border-collapse: collapse; }

/* Felső vízszintes csúszka (a táblával szinkronban), ha a tartalom nem fér ki */
.top-scroll { overflow-x: auto; overflow-y: hidden; margin-bottom: 6px; }
.top-scroll-inner { height: 1px; }
/* A széles táblák vízszintes csúszkája a tábla FÖLÖTT is megvan (a .top-scroll tükör), DE a wrap saját
   (alsó) vízszintes ÉS függőleges csúszkája is LÁTHATÓ és HÚZHATÓ — hogy ne csak görgővel lehessen mozogni. */
.table-wrap { scrollbar-width: auto; }
.table-wrap::-webkit-scrollbar { width: 12px; height: 12px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border-strong, #94a3b8); border-radius: 6px; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--accent, #007dbc); }
.table-wrap::-webkit-scrollbar-track { background: var(--bg2, #f1f5f9); border-radius: 6px; }

/* Rögzített (statikus) első oszlopok — a többi oszlop oldalra görgethető */
.sticky-col { position: sticky; z-index: 1; background: var(--panel); }
thead th.sticky-col { z-index: 3; background: var(--panel-2); }
tbody tr:hover .sticky-col { background: var(--accent-soft); }
.sticky-col-last { border-right: 2px solid var(--border-strong); }

/* Rögzített fejléc: a thead a görgetőablak tetején marad (görgetéskor látszik).
   z-index: a normál fejléccella a törzs fölött (2); a sarok (top+left sticky) legfelül (4). */
.table-wrap thead th { position: sticky; top: 0; z-index: 2; }
.table-wrap thead th.sticky-col { z-index: 4; }

/* Hosszú szöveg (név) levágása "…"-vel, teljes szöveg rámutatásra (title tooltip).
   A szélesség a --name-w változóból jön -> a fejléc szélét húzva állítható. */
.ellip { max-width: var(--name-w, 260px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A Termékek névoszlopa fix szélességű (a húzott --name-w szerint), hogy a húzás
   rövid névnél is láthatóan mozgassa az oszlopot. */
#prTable .ellip { width: var(--name-w, 260px); }

/* Oszlop-szélesség húzó-fogantyú a fejléc jobb szélén */
.col-resizer { position: absolute; top: 0; right: 0; width: 8px; height: 100%; cursor: col-resize; user-select: none; touch-action: none; }
.col-resizer::after { content: ""; position: absolute; top: 25%; right: 3px; height: 50%; border-right: 2px solid var(--border-strong); }
.col-resizer:hover::after, .col-resizer.dragging::after { border-color: var(--accent); }
thead th {
  text-align: left; padding: 12px 16px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  background: var(--panel-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
thead th.num { text-align: right; }
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: none; }
.cust-name { font-weight: 500; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--panel-2); border: 1px solid var(--border-strong); color: var(--muted);
  white-space: nowrap;
}
.badge.ok { background: #eafaf0; border-color: #bfe9cd; color: #1d8a43; }
.badge.warn { background: #fff7e6; border-color: #ffe2a8; color: #b7791f; }
.badge.bad { background: #fdecec; border-color: #f8c9c9; color: #c0392b; }

.dot-pill { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* ---------- Drawer (részletek) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(16,24,40,.4); display: flex; justify-content: flex-end; z-index: 50; }
.overlay.hidden { display: none; }
.drawer {
  width: min(720px, 100%); height: 100%; overflow-y: auto; background: var(--bg);
  border-left: 1px solid var(--border); padding: 26px 30px; position: relative;
  animation: slidein .2s ease-out;
}
@keyframes slidein { from { transform: translateX(24px); opacity: .5; } to { transform: none; opacity: 1; } }
.close { position: absolute; top: 16px; right: 18px; width: 34px; height: 34px; border-radius: 50%; background: var(--panel); border: 1px solid var(--border); font-size: 18px; color: var(--muted); }
.close:hover { color: var(--text); }
.drawer .back { position: absolute; top: 16px; right: 60px; width: 34px; height: 34px; border-radius: 50%; background: var(--panel); border: 1px solid var(--border); font-size: 18px; color: var(--muted); cursor: pointer; }
.drawer .back:hover { color: var(--text); }
.drawer .back.hidden { display: none; }
.drawer h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.detail-meta { display: flex; gap: 12px; align-items: center; margin: 6px 0 20px; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi-row .kpi-val { font-size: 19px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.card h3.sub { text-transform: uppercase; }
.comment { margin-bottom: 8px; }

table.items { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-top: 8px; }
table.items th { padding: 10px 12px; }
table.items td { padding: 11px 12px; }
.ship-row { background: var(--accent-soft); }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); border: 1px solid #bfe1f1; }

/* ---------- Login ---------- */
.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background:
    radial-gradient(900px 500px at 100% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, #fff7cc55, transparent 55%),
    var(--bg);
  padding: 20px;
}
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  padding: 36px 34px; width: 360px; box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; gap: 16px;
}
.login-logo { display: flex; align-items: center; gap: 10px; }
.login-logo .dot { width: 14px; height: 14px; border-radius: 5px; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); box-shadow: 0 0 0 5px var(--accent-soft); }
/* Login: középre igazított logó + kicsi verziószám */
/* A logó a jelszó mező (kártya tartalmi) szélességét veszi fel */
.login-logo-img { display: block; width: 100%; max-width: 100%; height: auto; margin: 2px 0 0; }
.login-version { text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .06em; margin: 0; }
.login-card h1 { margin: 6px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.login-card p.muted { margin: 0; }
.login-card input { padding: 12px 14px; }
.login-card .submit { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; padding: 12px; font-size: 15px; }
.login-card .submit:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.login-card .error { color: var(--red); display: none; margin: 0; font-size: 13px; }

/* ---------- Reszponzív ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .charts { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .charts { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  #search { min-width: 160px; flex: 1; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi-row { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  main { padding: 16px; }
}

/* ===================== CRM Feladatkezelő ===================== */
#view-crm { padding: 4px 0; }
.crm-head { display:flex; align-items:flex-start; gap:16px; margin-bottom:14px; flex-wrap:wrap; }
.crm-tiles { display:flex; gap:12px; flex-wrap:wrap; flex:1; }
.crm-tile { cursor:pointer; border:1px solid var(--border,#e4e8ee); border-radius:12px; padding:12px 18px; min-width:120px;
  background:var(--card,#fff); transition:transform .08s ease, box-shadow .12s ease; }
.crm-tile:hover { transform:translateY(-2px); box-shadow:0 6px 18px rgba(0,0,0,.08); }
.crm-tile.active { outline:2px solid var(--accent,#2d6cdf); }
.crm-tile .n { font-size:28px; font-weight:700; line-height:1; }
.crm-tile .l { font-size:13px; color:var(--muted,#6b7280); margin-top:6px; }
.crm-tile.s-open { border-top:3px solid #2d6cdf; }
.crm-tile.s-in_progress { border-top:3px solid #d99a00; }
.crm-tile.s-blocked { border-top:3px solid #c0392b; }
.crm-tile.s-done { border-top:3px solid #137a3a; }
.btn-primary { background:var(--accent,#2d6cdf); color:#fff; border:none; border-radius:10px; padding:10px 18px;
  font-size:14px; font-weight:600; cursor:pointer; white-space:nowrap; }
.btn-primary:hover { filter:brightness(1.06); }
.crm-toolbar { display:flex; align-items:center; gap:12px; margin-bottom:12px; flex-wrap:wrap; }
.crm-toolbar input[type=search] { padding:8px 12px; border:1px solid var(--border,#e4e8ee); border-radius:8px; min-width:240px; font-size:13px; }
.crm-chip-filter { background:#eef3fb; color:#2d6cdf; border-radius:20px; padding:4px 12px; font-size:12px; cursor:pointer; }
.crm-list { display:flex; flex-direction:column; gap:8px; }
.crm-row { display:flex; align-items:center; gap:12px; padding:12px 14px; border:1px solid var(--border,#e4e8ee);
  border-radius:10px; background:var(--card,#fff); cursor:pointer; }
.crm-row:hover { background:#f7f9fc; }
.crm-row .id { font-family:ui-monospace,monospace; font-size:12px; color:var(--muted,#6b7280); min-width:56px; }
.crm-row .ti { font-weight:600; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.crm-row .meta { font-size:12px; color:var(--muted,#6b7280); white-space:nowrap; }
.crm-badge { display:inline-block; font-size:11px; font-weight:600; padding:3px 9px; border-radius:20px; white-space:nowrap; }
.crm-badge.s-open { background:#eaf1fc; color:#2d6cdf; }
.crm-badge.s-in_progress { background:#fdf3e0; color:#b67d00; }
.crm-badge.s-blocked { background:#fbeae8; color:#c0392b; }
.crm-badge.s-done { background:#e7f5ec; color:#137a3a; }
.crm-prio { font-size:11px; padding:2px 7px; border-radius:6px; }
.crm-prio.high { background:#fbeae8; color:#c0392b; }
.crm-prio.normal { color:var(--muted,#6b7280); }
.crm-prio.low { color:#9aa3af; }
.crm-empty { padding:40px; text-align:center; color:var(--muted,#9ca3af); }
/* Feladat-részlet (a meglévő drawer-ben) */
.crm-detail h2 { margin:0 0 4px; }
.crm-detail .sub { font-size:12px; color:var(--muted,#6b7280); margin-bottom:14px; }
.crm-field { margin-bottom:14px; }
.crm-field > label { display:block; font-size:12px; font-weight:600; color:var(--muted,#6b7280); margin-bottom:5px; }
.crm-field input[type=text], .crm-field textarea, .crm-field select, .crm-field input[type=date] {
  width:100%; padding:8px 10px; border:1px solid var(--border,#e4e8ee); border-radius:8px; font-size:13px; font-family:inherit; box-sizing:border-box; }
.crm-field textarea { min-height:70px; resize:vertical; }
.crm-chips { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.crm-chip { display:inline-flex; align-items:center; gap:6px; background:#eef3fb; color:#234; border-radius:16px; padding:4px 10px; font-size:12px; }
.crm-chip a { cursor:pointer; color:#2d6cdf; text-decoration:none; }
.crm-chip .x { cursor:pointer; color:#c0392b; font-weight:700; }
.crm-addrow { display:flex; gap:6px; margin-top:6px; }
.crm-addrow input, .crm-addrow select { flex:1; }
.crm-addrow button { padding:6px 12px; border:1px solid var(--border,#e4e8ee); background:#fff; border-radius:8px; cursor:pointer; font-size:13px; }
.crm-assignees { display:flex; flex-wrap:wrap; gap:8px; }
.crm-assignees label { display:flex; align-items:center; gap:5px; font-size:13px; background:#f3f5f9; padding:4px 10px; border-radius:8px; cursor:pointer; }
.crm-comments { display:flex; flex-direction:column; gap:8px; margin-top:6px; }
.crm-comment { background:#f7f9fc; border-radius:8px; padding:8px 12px; font-size:13px; }
.crm-comment .who { font-size:11px; color:var(--muted,#6b7280); margin-bottom:3px; }
.crm-actions { display:flex; gap:10px; margin-top:18px; flex-wrap:wrap; }
.crm-actions button { padding:9px 18px; border-radius:9px; border:1px solid var(--border,#e4e8ee); background:#fff; cursor:pointer; font-size:14px; font-weight:600; }
.crm-actions .save { background:var(--accent,#2d6cdf); color:#fff; border:none; }
.crm-actions .reopen { background:#137a3a; color:#fff; border:none; }
.crm-activity { font-size:11px; color:var(--muted,#9ca3af); margin-top:6px; }
body.theme-crm { }

/* ===================== CRM 2. iteráció ===================== */
.crm-ro-note { background:#fff8e6; border:1px solid #f0dca0; color:#8a6d00; border-radius:8px; padding:8px 12px; font-size:12px; margin-bottom:14px; }
.crm-cps { display:flex; flex-direction:column; gap:6px; }
.crm-cp { display:flex; align-items:center; gap:10px; padding:6px 10px; background:#f7f9fc; border-radius:8px; font-size:13px; }
.crm-cp label { display:flex; align-items:center; gap:8px; cursor:pointer; flex:1; }
.crm-cp .cp-done { text-decoration:line-through; color:var(--muted,#9ca3af); }
.crm-cp .cp-by { font-size:11px; color:#137a3a; white-space:nowrap; }
.crm-cp .x { cursor:pointer; color:#c0392b; font-weight:700; }
.crm-log { display:flex; flex-direction:column; gap:4px; max-height:220px; overflow:auto; font-size:12px; }
.crm-act { color:var(--muted,#4b5563); padding:3px 0; border-bottom:1px dashed var(--border,#eef1f5); }
.crm-act b { color:#234; }
/* másodlagos kártya-popup a feladat felett */
#crmCard { z-index: 1200; }
#crmCard .drawer { z-index: 1201; }
.order-crm-tasks { margin:10px 0; }
.order-crm-tasks .octask { padding:8px 10px; border:1px solid var(--border,#e4e8ee); border-radius:8px; margin-top:6px; cursor:pointer; font-size:13px; display:flex; align-items:center; gap:8px; }
.order-crm-tasks .octask:hover { background:#f7f9fc; }

/* ===================== CRM 3-4. iteráció ===================== */
.crm-row .ti .desc { color:var(--muted,#9ca3af); font-weight:400; }
.crm-row .meta .by { color:#2d6cdf; }
/* Fő folyam: hozzászólások */
.crm-flow > label { font-size:13px; }
.crm-comments { display:flex; flex-direction:column; gap:8px; max-height:340px; overflow:auto; padding:4px 2px; margin-bottom:8px; }
.crm-comment { background:#f7f9fc; border-radius:10px; padding:9px 13px; }
.crm-comment .who { font-size:11px; color:var(--muted,#6b7280); margin-bottom:3px; }
.crm-comment .who b { color:#234; }
.crm-comment .txt { font-size:14px; white-space:pre-wrap; word-break:break-word; }
.crm-commentbox { position:relative; display:flex; gap:8px; align-items:flex-end; }
.crm-commentbox textarea { flex:1; min-height:64px; resize:vertical; padding:9px 11px; border:1px solid var(--border,#e4e8ee); border-radius:9px; font:inherit; font-size:14px; box-sizing:border-box; }
/* @-említés autocomplete */
.crm-mention-pop { position:absolute; left:0; bottom:100%; margin-bottom:4px; background:var(--card,#fff); border:1px solid var(--border,#e4e8ee); border-radius:8px; box-shadow:0 6px 18px rgba(0,0,0,.12); z-index:1300; min-width:160px; overflow:hidden; }
.crm-mention-pop .mi { padding:7px 12px; font-size:13px; cursor:pointer; }
.crm-mention-pop .mi:hover { background:#eef3fb; color:#2d6cdf; }
.crm-ment { background:#eef3fb; color:#2d6cdf; border-radius:5px; padding:0 4px; font-weight:600; }
.crm-ment.me { background:#fde9c8; color:#9a5b00; }
/* Engem említettek gomb + badge */
.crm-ment-btn { background:#fff; border:1px solid var(--border,#e4e8ee); border-radius:8px; padding:7px 12px; font-size:13px; cursor:pointer; display:inline-flex; align-items:center; gap:6px; }
.crm-ment-btn:hover { background:#f7f9fc; }
.crm-ment-badge { background:#e02424; color:#fff; border-radius:999px; font-size:11px; font-weight:700; padding:1px 7px; min-width:18px; text-align:center; }
.mention-row .mtext { font-size:13px; color:#333; margin:3px 0; }
/* lenyíló eseménynapló */
.crm-logd { border:1px solid var(--border,#eef1f5); border-radius:8px; padding:4px 10px; }
.crm-logd > summary { cursor:pointer; font-size:12px; color:var(--muted,#6b7280); font-weight:600; padding:5px 0; user-select:none; }
.crm-logd[open] > summary { margin-bottom:6px; }

/* Említések csempe */
.crm-tile.s-mention { border-top:3px solid #e02424; }
.crm-tile.s-mention .l { color:#c0392b; font-weight:600; }

/* Új feladat státusz + sor-kiemelés */
.crm-tile.s-new { border-top:3px solid #7c3aed; }
.crm-badge.s-new { background:#efe7fd; color:#6d28d9; }
.crm-row.is-new { background:#f3edff; }
.crm-row.is-new:hover { background:#ece1ff; }
/* Scope-választó (Mind a sajátom / Nekem címzett / Általam kiadott / Mindenki) */
.crm-scope { display:inline-flex; gap:2px; background:var(--panel-2,#eef1f5); border:1px solid var(--border,#e4e8ee); border-radius:9px; padding:2px; }
.crm-scope button { background:transparent; border:none; padding:6px 12px; border-radius:7px; font-size:13px; font-weight:600; color:var(--muted,#6b7280); cursor:pointer; white-space:nowrap; }
.crm-scope button.active { background:var(--card,#fff); color:#2d6cdf; box-shadow:0 1px 3px rgba(0,0,0,.08); }

/* CRM értesítés-gomb */
.crm-push-btn { background:#fff; border:1px solid var(--border,#e4e8ee); border-radius:8px; padding:7px 12px; font-size:13px; font-weight:600; cursor:pointer; color:var(--muted,#6b7280); white-space:nowrap; }
.crm-push-btn:hover { background:#f7f9fc; }
.crm-push-btn.on { background:#e7f5ec; color:#137a3a; border-color:#abefc6; }

/* CRM feladatlista — táblázat */
.crm-list { overflow-x:auto; background:var(--card,#fff); border:1px solid var(--border,#e4e8ee); border-radius:12px; }
.crm-table { width:100%; border-collapse:collapse; font-size:13px; }
.crm-table thead th { text-align:left; padding:9px 10px; font-size:11px; font-weight:700; color:var(--muted,#6b7280); border-bottom:2px solid var(--border,#e4e8ee); white-space:nowrap; position:sticky; top:0; background:var(--card,#fff); }
.crm-table tbody td { padding:9px 10px; border-bottom:1px solid var(--border,#eef1f5); vertical-align:middle; }
.crm-table tbody tr { cursor:pointer; }
.crm-table tbody tr:hover { background:#f7f9fc; }
.crm-table tr.is-new td { background:#f3edff; }
.crm-table tr.is-new:hover td { background:#ece1ff; }
.crm-table .id { font-family:ui-monospace,monospace; color:var(--muted,#6b7280); white-space:nowrap; font-size:12px; }
.crm-table .ti { max-width:260px; }
.crm-table .ti b { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.crm-table .ti .small { font-weight:400; }
.crm-table .desc { max-width:240px; color:var(--muted,#6b7280); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.crm-table td .crm-badge { font-size:11px; }

/* --- Tömbösített lista: szekció-fejlécek + „ma lejár"/lejárt jelzés ------ */
/* Tömb-fejlécek: színkódolt „kártya"-sáv + színes bal szegély (a vizuális elkülönülésért) */
.crm-table tr.crm-section td { color:var(--ink,#1f2937); font-size:12.5px; font-weight:700; padding:9px 12px; cursor:default;
  background:var(--panel-2,#f4f6f9); border:none; border-left:4px solid var(--border,#cbd2dc); border-radius:8px 8px 0 0; }
.crm-table tr.crm-section:hover td { background:var(--panel-2,#f4f6f9); }
.crm-table tr.crm-section .cnt { display:inline-block; margin-left:8px; font-size:11px; font-weight:700; color:var(--muted,#6b7280);
  background:rgba(0,0,0,.06); border-radius:10px; padding:1px 8px; }
.crm-table tr.crm-section.tone-high td { background:#fbeae8; border-left-color:#c0392b; }
.crm-table tr.crm-section.tone-new  td { background:#efe7fd; border-left-color:#7c3aed; }
.crm-table tr.crm-section.tone-rest td { background:#eceef2; border-left-color:#64748b; }
.crm-table tr.crm-section.tone-done td { background:#e7f5ec; border-left-color:#137a3a; }
/* Lélegzetvételnyi szünet a tömbök közt (átlátszó sor, szegély nélkül) */
.crm-table tr.crm-gap td { height:16px; padding:0; border:none; background:transparent; }

/* === Egységes „aktív/kiválasztott sor" jelölés (drawer megnyitva v. kiválasztott szűrő) ===
   Beszerzés: a megnyitott sor (.row-open); Pénzügy: a kiválasztott feladó (.row-sel). Azonos stílus. */
#prTable tbody tr.row-open > td,
#finSenderTable tbody tr.row-sel > td { background:rgba(45,108,223,.12); }
#prTable tbody tr.row-open:hover > td,
#finSenderTable tbody tr.row-sel:hover > td { background:rgba(45,108,223,.16); }
#prTable tbody tr.row-open > td:first-child,
#finSenderTable tbody tr.row-sel > td:first-child { box-shadow:inset 3px 0 0 var(--accent,#2d6cdf); }
#finSenderTable tbody tr.row-sel > td { font-weight:600; }
.crm-table tr.due-today td { background:#fff7f6; }
.crm-table tr.due-today:hover td { background:#ffeeec; }
.crm-due { display:inline-block; font-size:10px; font-weight:700; padding:1px 7px; border-radius:10px; margin-left:6px; vertical-align:middle; white-space:nowrap; }
.crm-due.today { background:#fbeae8; color:#c0392b; }
.crm-due.over { background:#f3d9d6; color:#8a1c12; }
.crm-tile.s-due { border-top:3px solid #e02424; }
.crm-tile.s-due .l { color:#c0392b; font-weight:600; }
.crm-tile.s-over { border-top:3px solid #8a1c12; }
.crm-tile.s-over .l { color:#8a1c12; font-weight:600; }

/* Nézet- és csoport-váltó: egyértelműbb (felirat + tömör kék aktív állapot) */
.crm-toglbl { align-self:center; font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.04em;
  color:var(--muted,#6b7280); padding:0 8px 0 6px; }
.crm-viewtoggle button.active, .crm-ganttgroup button.active { background:var(--accent,#2d6cdf); color:#fff; box-shadow:0 1px 4px rgba(45,108,223,.35); }
.crm-viewtoggle button, .crm-ganttgroup button { transition:background .12s, color .12s; }

/* --- Gantt nézet (csak admin) ------------------------------------------- */
.crm-gantt { overflow-x:auto; border:1px solid var(--border,#e4e8ee); border-radius:12px; background:var(--card,#fff); -webkit-overflow-scrolling:touch; }
.crm-gantt-inner { position:relative; }
.crm-gantt-axis { display:flex; position:sticky; top:0; z-index:3; background:var(--card,#fff); border-bottom:2px solid var(--border,#e4e8ee); height:26px; }
.crm-gantt-axis .lbl-spacer { flex:0 0 auto; position:sticky; left:0; z-index:4; background:var(--card,#fff); border-right:1px solid var(--border,#e4e8ee); }
.crm-gantt-axis .track { position:relative; flex:0 0 auto; }
.crm-gantt-tick { position:absolute; top:0; bottom:0; border-left:1px solid var(--border,#eef1f5); font-size:10px; color:var(--muted,#6b7280); padding-left:4px; white-space:nowrap; }
.crm-gantt-tick.month { border-left:1px solid #c7ccd4; font-weight:700; }
.crm-gantt-grouphead { display:flex; align-items:center; gap:6px; padding:5px 10px; font-size:12px; font-weight:700; color:var(--muted,#6b7280);
  background:var(--panel-2,#f4f6f9); border-bottom:1px solid var(--border,#eef1f5); position:sticky; left:0; }
.crm-gantt-grouphead .cnt { font-weight:500; opacity:.7; }
.crm-gantt-row { display:flex; align-items:stretch; border-bottom:1px solid var(--border,#f0f2f5); min-height:30px; cursor:pointer; }
.crm-gantt-row:hover { background:#f7f9fc; }
.crm-gantt-row.is-new { box-shadow:inset 3px 0 0 #7c3aed; }
.crm-gantt-label { flex:0 0 auto; position:sticky; left:0; z-index:2; background:var(--card,#fff); border-right:1px solid var(--border,#e4e8ee);
  padding:5px 10px; display:flex; flex-direction:column; justify-content:center; overflow:hidden; }
.crm-gantt-row:hover .crm-gantt-label { background:#f7f9fc; }
.crm-gantt-label b { font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.crm-gantt-label .sub { font-size:10px; color:var(--muted,#6b7280); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.crm-gantt-track { position:relative; flex:0 0 auto; }
.crm-gantt-bar { position:absolute; top:6px; height:18px; border-radius:5px; box-sizing:border-box; min-width:6px;
  font-size:10px; color:#fff; line-height:18px; padding:0 6px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.crm-gantt-bar.s-new { background:#7c3aed; }
.crm-gantt-bar.s-in_progress { background:#d99a00; }
.crm-gantt-bar.s-blocked { background:#c0392b; }
.crm-gantt-bar.s-done { background:#137a3a; }
.crm-gantt-bar.ongoing { -webkit-mask-image:linear-gradient(90deg,#000 72%,transparent); mask-image:linear-gradient(90deg,#000 72%,transparent); }
.crm-gantt-bar.overdue { outline:2px solid #e02424; outline-offset:1px; }
.crm-gantt-today { position:absolute; top:0; bottom:0; width:0; border-left:2px solid #e02424; z-index:1; pointer-events:none; }

/* ============================================================
   MOBIL RESZPONZÍV — átfogó (tablet ≤768px, telefon ≤430px)
   ============================================================ */
@media (max-width: 768px) {
  /* Fejléc: kcompakt, a fülek vízszintesen görgethetők */
  .topbar { padding: 10px 12px; gap: 8px 10px; }
  .brand { font-size: 15px; gap: 8px; }
  #brandTitle { min-width: 0; font-size: 15px; white-space: nowrap; }
  .brand-ver { font-size: 9px; }
  .loading-flag { min-width: 0; }
  .tabs { flex-wrap: wrap; max-width: 100%; }   /* MINDEN fül látszódjon — sortörés, nem görgetés */
  .tab { padding: 7px 11px; font-size: 13px; }
  .userbar { gap: 6px; }
  #meLabel { display: none; }            /* email cím elrejtése szűk helyen */
  .userbar .tab { padding: 7px 10px; }
  /* Al-fülek (Megrendelések) + bármilyen szűrősor görgethető marad */
  #orderSubtabs, .subtabs-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Fő tartalom: kisebb térköz, teljes szélesség */
  main { padding: 14px 12px 32px; max-width: 100%; }
  /* Szűrők: minden vezérlő törhet, a kereső teljes sor */
  .filters { gap: 8px; }
  .filters-group { width: 100%; flex-wrap: wrap; }
  .filters input[type="search"], #search, #smSearch, #procSearch, #finSearch, #finSenderSearch {
    min-width: 0 !important; width: 100%; flex: 1 1 100% !important; }
  /* KPI kártyák: 2 oszlop */
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  /* Drawer: kisebb belső térköz */
  .drawer { padding: 18px 16px; }
  .drawer h2 { font-size: 17px; }
  /* Táblák: biztos vízszintes görgetés + kisebb cella-padding + magasság */
  .table-wrap { max-height: calc(100vh - 200px); }
  th, td { padding: 8px 9px; }
  /* CRM eszköztár + csempék + lista */
  .crm-head { gap: 10px; }
  .crm-toolbar { gap: 8px; }
  .crm-toolbar input[type="search"] { min-width: 0; width: 100%; flex: 1 1 100%; }
  .crm-scope { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
  .crm-push-btn { margin-left: 0 !important; }
  .crm-tile { min-width: 0; flex: 1 1 calc(50% - 8px); padding: 10px 12px; }
  .crm-tile .n { font-size: 22px; }
  /* INLINE layout-ok felülírása mobilra (geo 2×2 + belső rácsok + Pénzügy oldalsáv) */
  [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; gap: 14px !important; }
  [style*="minmax(0,1fr) 148px"], [style*="minmax(0,210px) 1fr"] { grid-template-columns: 1fr !important; }
  .table-wrap[style*="nowrap"] { flex-wrap: wrap !important; }
  .table-wrap[style*="nowrap"] > div[style*="flex:0 0 400px"] { flex: 1 1 100% !important; }
}
@media (max-width: 430px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: 1fr; }
  .crm-tile { flex: 1 1 calc(50% - 6px); }
  .tab { padding: 7px 9px; font-size: 12px; }
  .drawer { padding: 16px 12px; }
  main { padding: 12px 10px 28px; }
}

/* ============================================================
   MOBIL — célzott javítások (Android + iPhone/iOS)
   ============================================================ */
@media (max-width: 768px) {
  /* iOS: a form-mezők 16px-esek legyenek, különben Safari rázoomol fókuszkor */
  input, select, textarea, .ms-btn { font-size: 16px; }
  .tab, .subtab, .crm-scope button, .crm-push-btn, .ghost { font-size: 13px; }
  /* iOS momentum-görgetés + dvh (a 100vh-s címsor-ugrás ellen) */
  .table-wrap, .crm-list, .ms-panel { -webkit-overflow-scrolling: touch; }
  .table-wrap { max-height: calc(100dvh - 190px); }

  /* „Mentett adatok / kezelt időszak" sáv: törjön, ne legyen magas, ne csússzon ki */
  .freshbar { flex-wrap: wrap; align-items: flex-start; row-gap: 2px; padding: 7px 11px; line-height: 1.3; font-size: 11.5px; margin-bottom: 10px; }
  .freshbar > * { min-width: 0; }
  .freshbar b { font-weight: 700; }
  .freshbar .freshbtn { margin-left: 0; flex: 0 0 auto; }

  /* Dátumtartomány: a vezérlők törjenek — a „↺"/tartomány gomb ne lógjon le */
  .daterange { flex-wrap: wrap; gap: 6px; width: 100%; }
  .daterange input[type="date"] { flex: 1 1 42%; min-width: 0; }

  /* Multiselect (Beszerzés szállítók stb.) kinyíló panel: ne lógjon ki a képből */
  /* A kinyíló panel a képernyő-szélekhez igazított alsó lap (bottom sheet) -> SOSEM lóghat ki */
  .ms-panel { position: fixed; left: 10px; right: 10px; bottom: 10px; top: auto; width: auto; min-width: 0; max-width: none; max-height: 60vh; overflow-y: auto; box-shadow: 0 -8px 30px rgba(16,24,40,.18); }

  /* Natív select-ek és keresők (pl. Pénzügy feladó): ne lógjanak túl */
  select { max-width: 100%; }
  #finSender, #finSenderSearch, #finSearch, #finDateFrom, #procSearch { max-width: 100%; }

  /* DRAWER / RÉSZLETNÉZET (rendelés + termék) reszponzív tartalom */
  .grid2 { grid-template-columns: 1fr !important; }
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-row .kpi-val { font-size: 17px; }
  .detail-meta { flex-wrap: wrap; }
  /* a részlet táblái (tételek, GLS/MPL bontás, termék-összevetés) vízszintesen görgethetők, ne törjék a drawert */
  .drawer table { width: 100%; font-size: 13px; table-layout: fixed; }
  .drawer th, .drawer td { padding: 8px 8px; white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
  .drawer .card { min-width: 0; }
  /* ha egy táblát mégsem lehet tördelni (számoszlopok), görgethető */
  .drawer .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 430px) {
  .kpi-row { grid-template-columns: 1fr; }
}

/* Megrendelésszám alatti szöveges jelölés (pl. „teljesítettnek vett") — ne dúzza szét az oszlopot */
.num-sub { margin-top: 4px; white-space: normal; }
.num-sub .badge { font-weight: 600; }

/* ============================================================
   Időpont foglalás — Bérlés Naptár (Google Calendar)
   ============================================================ */
.tab-badge { display:inline-block; min-width:16px; height:16px; line-height:16px; padding:0 4px; margin-left:6px; border-radius:9px;
  background:#e02424; color:#fff; font-size:11px; font-weight:700; text-align:center; vertical-align:middle; }
.bk-toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.bk-nav { display:inline-flex; gap:4px; }
.bk-nav .ghost { padding:6px 12px; font-weight:700; }
.bk-range { font-size:15px; font-weight:700; color:var(--ink,#1f2937); }
.bk-status { font-size:12px; color:var(--muted,#6b7280); }
.bk-cal { min-height:200px; }
.bk-empty, .bk-none { color:var(--muted,#9ca3af); }
.bk-empty { padding:32px; text-align:center; font-size:14px; }

/* Mai foglalások kártya */
.bk-today { border:1px solid #fcd9b6; background:#fff7ed; border-radius:12px; padding:12px 14px; margin-bottom:14px; box-shadow:inset 4px 0 0 #ea9b40; }
.bk-today-h { font-weight:700; font-size:14px; color:#9a5b00; margin-bottom:8px; }
.bk-today-c { display:inline-block; background:#ea9b40; color:#fff; border-radius:10px; padding:0 8px; font-size:12px; margin-left:6px; }
.bk-today-list { display:flex; flex-direction:column; gap:5px; }
.bk-today-item { cursor:pointer; padding:5px 8px; border-radius:8px; font-size:13px; background:rgba(234,155,64,.10); }
.bk-today-item:hover { background:rgba(234,155,64,.20); }
.bk-today-time { font-weight:700; color:#9a5b00; }

/* Esemény-chip (hét/hónap) */
.bk-ev { cursor:pointer; font-size:11.5px; line-height:1.3; padding:2px 6px; margin:2px 0; border-radius:6px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  background:rgba(45,108,223,.12); border-left:3px solid var(--accent,#2d6cdf); color:var(--ink,#1f2937); }
.bk-ev:hover { background:rgba(45,108,223,.22); }
.bk-ev-t { font-weight:700; color:var(--accent,#2d6cdf); }
.bk-more { cursor:pointer; font-size:11px; color:var(--accent,#2d6cdf); font-weight:600; padding:1px 6px; }

/* Napi (agenda) */
.bk-agenda { display:flex; flex-direction:column; gap:10px; }
.bk-card { display:flex; gap:14px; border:1px solid var(--border,#e4e8ee); border-radius:12px; padding:12px 14px; cursor:pointer; background:var(--card,#fff); box-shadow:inset 4px 0 0 var(--accent,#2d6cdf); }
.bk-card:hover { background:#f7f9fc; }
.bk-card-time { flex:0 0 120px; font-weight:700; color:var(--accent,#2d6cdf); font-size:14px; }
.bk-card-title { font-weight:700; font-size:15px; margin-bottom:4px; }
.bk-line { font-size:13px; color:var(--muted,#6b7280); }
.bk-cdesc { font-size:13px; color:var(--muted,#6b7280); margin-top:4px; white-space:pre-line; }

/* Heti */
.bk-week { display:grid; grid-template-columns:repeat(7,1fr); gap:8px; }
.bk-wcol { border:1px solid var(--border,#e4e8ee); border-radius:10px; overflow:hidden; min-height:120px; }
.bk-whead { background:var(--panel-2,#f4f6f9); padding:6px 8px; font-size:12px; color:var(--muted,#6b7280); cursor:pointer; border-bottom:1px solid var(--border,#eef1f5); }
.bk-whead b { color:var(--ink,#1f2937); font-size:14px; }
.bk-wcol.today .bk-whead { background:rgba(45,108,223,.14); color:var(--accent,#2d6cdf); }
.bk-wcol.today { border-color:var(--accent,#2d6cdf); }
.bk-wbody { padding:6px; }

/* Havi */
.bk-mhead, .bk-mgrid { display:grid; grid-template-columns:repeat(7,1fr); }
.bk-mhead { gap:0; margin-bottom:4px; }
.bk-mhd { text-align:center; font-size:11px; font-weight:700; color:var(--muted,#6b7280); padding:4px 0; }
.bk-mgrid { gap:6px; }
.bk-mcell { min-height:96px; border:1px solid var(--border,#eef1f5); border-radius:8px; padding:4px; background:var(--card,#fff); overflow:hidden; }
.bk-mcell.out { background:var(--panel-2,#f7f8fa); }
.bk-mcell.out .bk-mnum { color:var(--muted,#b6bcc6); }
.bk-mcell.today { border-color:var(--accent,#2d6cdf); box-shadow:0 0 0 1px var(--accent,#2d6cdf) inset; }
.bk-mnum { font-size:12px; font-weight:700; color:var(--ink,#1f2937); cursor:pointer; padding:2px 4px; display:inline-block; }
.bk-mcell.today .bk-mnum { color:#fff; background:var(--accent,#2d6cdf); border-radius:50%; min-width:20px; text-align:center; }

/* Éves (mini hónapok, hőtérkép) */
.bk-year { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
.bk-ymonth { border:1px solid var(--border,#eef1f5); border-radius:10px; padding:8px; }
.bk-ymhead { text-transform:capitalize; font-weight:700; font-size:13px; margin-bottom:6px; cursor:pointer; }
.bk-ygrid { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; }
.bk-yd { aspect-ratio:1; display:flex; align-items:center; justify-content:center; font-size:10px; border-radius:4px; color:var(--muted,#9ca3af); }
.bk-yd.empty { visibility:hidden; }
.bk-yd.has { cursor:pointer; color:#fff; font-weight:700; background:rgba(45,108,223,calc(.35 + var(--c,0)*.55)); }
.bk-yd.today { outline:2px solid #e02424; outline-offset:-1px; color:var(--accent,#2d6cdf); font-weight:700; }
.bk-yd.has.today { color:#fff; }

/* Esemény-részlet (drawer) */
.bk-detail { display:flex; flex-direction:column; gap:10px; margin-top:8px; }
.bk-d-row { display:flex; gap:10px; font-size:14px; }
.bk-d-row.col { flex-direction:column; gap:4px; }
.bk-d-row.col .bk-d-l { flex:0 0 auto; }   /* oszlop-elrendezésben a címke NE legyen 120px magas (ez okozta a nagy hézagot) */
.bk-d-l { flex:0 0 120px; color:var(--muted,#6b7280); font-weight:600; }
.bk-d-v { color:var(--ink,#1f2937); }
.bk-d-desc { background:var(--panel-2,#f4f6f9); border-radius:8px; padding:10px 12px; font-size:13px; line-height:1.5; white-space:pre-wrap; }

/* Belépő-felugró */
.bk-popup { position:fixed; right:18px; bottom:18px; width:320px; max-width:calc(100vw - 36px); z-index:1200;
  background:var(--card,#fff); border:1px solid var(--border,#e4e8ee); border-radius:12px; box-shadow:0 10px 30px rgba(0,0,0,.18);
  transform:translateY(20px); opacity:0; pointer-events:none; transition:transform .2s, opacity .2s; }
.bk-popup.show { transform:translateY(0); opacity:1; pointer-events:auto; }
.bk-popup-h { display:flex; align-items:center; justify-content:space-between; font-weight:700; font-size:14px; color:#9a5b00;
  background:#fff7ed; border-bottom:1px solid #fcd9b6; padding:10px 12px; border-radius:12px 12px 0 0; }
.bk-popup-x { background:none; border:none; font-size:18px; cursor:pointer; color:var(--muted,#6b7280); line-height:1; }
.bk-popup-list { padding:8px; display:flex; flex-direction:column; gap:4px; }
.bk-popup-item { cursor:pointer; padding:6px 8px; border-radius:8px; font-size:13px; }
.bk-popup-item:hover { background:var(--panel-2,#f4f6f9); }

@media (max-width:768px){
  .bk-week { grid-template-columns:repeat(7,minmax(110px,1fr)); overflow-x:auto; }
  .bk-year { grid-template-columns:repeat(2,1fr); }
  .bk-card-time { flex-basis:90px; }
}
.bk-src { display:inline-block; font-size:10px; font-weight:700; color:#fff; padding:1px 7px; border-radius:10px; margin-left:6px; vertical-align:middle; white-space:nowrap; }

/* Új feladat / Új időpont gombok: asztalon egymás mellett, mobilon alá */
.crm-head-actions { display:flex; gap:8px; flex:0 0 auto; align-items:flex-start; }
.btn-booking { background:#0891b2; }
.btn-booking:hover { background:#0e7490; }
@media (max-width:600px){ .crm-head-actions { flex-direction:column; align-items:stretch; width:100%; } .crm-head-actions .btn-primary { width:100%; } }

/* Új időpont foglalás modal */
#bkFormOverlay { display:flex; align-items:center; justify-content:center; padding:20px; }
.bk-form { position:relative; background:var(--card,#fff); border-radius:14px; box-shadow:0 20px 50px rgba(0,0,0,.25);
  width:560px; max-width:calc(100vw - 32px); max-height:calc(100vh - 40px); overflow:auto; padding:22px 24px; }
.bk-form > h2 { margin:0 0 16px; font-size:18px; }
.bk-form .close { position:absolute; top:10px; right:12px; background:none; border:none; font-size:24px; line-height:1; cursor:pointer; color:var(--muted,#6b7280); }
.bk-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px 16px; }
.bk-form-grid label { display:flex; flex-direction:column; gap:4px; font-size:13px; font-weight:600; color:var(--muted,#6b7280); }
.bk-form-grid label.full { grid-column:1 / -1; }
.bk-form-grid input, .bk-form-grid textarea { font-weight:400; color:var(--text,#1a2330); width:100%; }
.bk-form-hint { margin:14px 0 0; font-size:12px; color:var(--muted,#6b7280); background:var(--panel-2,#f8fafc); border:1px solid var(--border,#e7ebf0); border-radius:8px; padding:8px 12px; line-height:1.5; }
.bk-form-actions { display:flex; align-items:center; gap:10px; margin-top:18px; }
.bk-form-msg { font-size:13px; color:var(--muted,#6b7280); margin-right:auto; }
.bk-form-msg.err { color:#c0392b; font-weight:600; }
@media (max-width:560px){ .bk-form-grid { grid-template-columns:1fr; } }

#profileOverlay { display:flex; align-items:center; justify-content:center; padding:20px; }
#profileOverlay .bk-form { width:420px; }

/* FEED al-fül: feed-kártyák + státusz-badge-ek */
.feed-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:10px; margin:0 0 12px; }
.feed-card { border:1px solid var(--border,#e4e8ee); border-radius:10px; padding:10px 12px; background:var(--card,#fff); cursor:pointer; }
.feed-card.sel { border-color:var(--accent,#007dbc); box-shadow:0 0 0 1px var(--accent,#007dbc) inset; }
.feed-card-head { display:flex; align-items:center; gap:8px; }
.feed-card-head .feed-refresh { margin-left:auto; padding:2px 8px; font-size:12px; }
.feed-card-info { color:var(--muted,#6b7280); font-size:12px; margin:6px 0; }
.feed-card-stats { display:flex; flex-wrap:wrap; gap:6px; }
.feed-badge { display:inline-block; padding:1px 7px; border-radius:999px; font-size:12px; font-weight:600; background:var(--bg2,#eef1f5); color:var(--muted,#555); white-space:nowrap; }
.feed-badge.ok { background:#e7f7ee; color:#177245; }
.feed-badge.warn { background:#fff3e0; color:#b45309; }

/* FEED tábla: LÁTHATÓ scrollbar (a globálisan rejtett felülírása) + kötött magasság + húzható név-oszlop */
.feed-wrap { scrollbar-width: auto; max-height: 62vh; }
.feed-wrap::-webkit-scrollbar { width: 12px; height: 12px; }
.feed-wrap::-webkit-scrollbar-thumb { background: var(--border-strong,#94a3b8); border-radius: 6px; }
.feed-wrap::-webkit-scrollbar-track { background: var(--bg2,#f1f5f9); }
#feedTable .feed-prod { width: var(--name-w,240px); max-width: var(--name-w,240px); }
#feedTable thead th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
#feedTable thead th[data-sort]:hover { color: var(--accent,#007dbc); }
.feed-card-note { margin-top:8px; font-size:11.5px; line-height:1.4; color:var(--warn,#b45309); background:var(--warn-bg,#fff7ed); border:1px solid var(--warn,#f59e0b); border-radius:6px; padding:5px 8px; }
/* CRM feladat-csatolmányok */
.crm-att a { cursor:pointer; }
.crm-att-pending { opacity:.75; border-style:dashed; }
/* CRM lista: határidő a Frissítve oszlopban */
.crm-duedate { font-size:11px; margin-top:2px; color:var(--muted,#6b7280); white-space:nowrap; }
.crm-duedate.today { color:var(--warn,#b45309); font-weight:600; }
.crm-duedate.over { color:var(--bad,#dc2626); font-weight:600; }

/* === Profil: szekciók, értesítés-mátrix, útmutató-gomb === */
.pf-section { margin:16px 0 0; }
.pf-sec-label { font-size:13px; font-weight:700; color:var(--text,#1a2330); margin:14px 0 8px; }
.pf-push-btn { width:100%; text-align:left; background:var(--panel-2,#f8fafc); border:1px solid var(--border,#e4e8ee); border-radius:9px; padding:10px 14px; font-size:13px; font-weight:600; cursor:pointer; color:var(--muted,#6b7280); }
.pf-push-btn:hover { background:#eef2f7; }
.pf-push-btn.on { background:#e7f5ec; color:#137a3a; border-color:#abefc6; }
.pf-push-btn:disabled { opacity:.6; cursor:default; }
.pf-notify-hint { font-size:12px; line-height:1.5; margin:8px 2px; }
.pf-notify-grid { border:1px solid var(--border,#e7ebf0); border-radius:10px; overflow:hidden; }
.pfn-row { display:grid; grid-template-columns:1fr 74px 74px; align-items:center; gap:6px; padding:9px 12px; border-top:1px solid var(--border,#eef1f5); }
.pfn-row:first-child { border-top:none; }
.pfn-head { background:var(--panel-2,#f8fafc); font-size:12px; font-weight:700; color:var(--muted,#6b7280); text-align:center; }
.pfn-head span:first-child { text-align:left; }
.pfn-row:not(.pfn-head) span:nth-child(2), .pfn-row:not(.pfn-head) span:nth-child(3) { text-align:center; }
.pfn-label { font-size:13px; color:var(--text,#1a2330); }
.pfn-cb { width:18px; height:18px; cursor:pointer; accent-color:var(--accent,#007dbc); }
.pf-manual-btn { position:relative; width:100%; text-align:left; background:var(--panel-2,#f8fafc); border:1px solid var(--border,#e4e8ee); border-radius:9px; padding:11px 14px; font-size:14px; font-weight:700; cursor:pointer; color:var(--accent,#007dbc); }
.pf-manual-btn:hover { background:#eef2f7; }
.rem-chnote { font-size:11px; line-height:1.45; margin-top:6px; }

/* === Felhasználói útmutató panel === */
.manual-box { position:relative; background:var(--card,#fff); border-radius:14px 0 0 14px; box-shadow:0 20px 50px rgba(0,0,0,.25);
  width:900px; max-width:100vw; height:100vh; max-height:100vh; overflow:auto; padding:22px 26px; }
.manual-box > h2 { margin:0 0 14px; font-size:20px; }
.manual-box .close { position:absolute; top:12px; right:14px; background:none; border:none; font-size:26px; line-height:1; cursor:pointer; color:var(--muted,#6b7280); }
.manual-whatsnew { background:var(--panel-2,#f8fafc); border:1px solid var(--border,#e7ebf0); border-radius:12px; padding:14px 16px; margin:0 0 18px; }
.manual-whatsnew h3 { margin:0 0 10px; font-size:15px; }
.mn-entry { padding:9px 0; border-top:1px dashed var(--border,#e7ebf0); }
.mn-entry:first-of-type { border-top:none; }
.mn-e-head { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.mn-e-title { font-size:14px; font-weight:700; color:var(--text,#1a2330); }
.mn-e-date { font-size:12px; color:var(--muted,#9aa4b2); margin-left:auto; }
.mn-e-sum { font-size:13px; color:var(--muted,#6b7280); line-height:1.5; margin-top:3px; }
.mn-badge { display:inline-block; background:#e11d48; color:#fff; font-size:10px; font-weight:800; letter-spacing:.4px; border-radius:6px; padding:2px 6px; }
.mn-entry.mn-new { background:#fff7f9; border-radius:8px; margin:0 -8px; padding-left:8px; padding-right:8px; }
.manual-layout { display:grid; grid-template-columns:210px 1fr; gap:20px; align-items:start; }
.manual-nav { position:sticky; top:0; display:flex; flex-direction:column; gap:2px; font-size:13px; }
.manual-nav a { color:var(--muted,#6b7280); text-decoration:none; padding:6px 10px; border-radius:7px; }
.manual-nav a:hover { background:var(--panel-2,#f1f5f9); color:var(--text,#1a2330); }
.manual-body { min-width:0; }
.man-sec { margin:0 0 22px; scroll-margin-top:12px; }
.man-sec h3 { margin:0 0 8px; font-size:16px; color:var(--text,#1a2330); border-bottom:2px solid var(--border,#eef1f5); padding-bottom:6px; }
.man-sec p { font-size:14px; line-height:1.6; color:var(--text,#374151); margin:0 0 8px; }
.man-sec ul { margin:6px 0 10px; padding-left:20px; }
.man-sec li { font-size:14px; line-height:1.55; color:var(--text,#374151); margin:3px 0; }
@media (max-width:720px){ .manual-box { width:100vw; border-radius:0; padding:18px 16px; } .manual-layout { grid-template-columns:1fr; } .manual-nav { flex-direction:row; flex-wrap:wrap; margin-bottom:10px; } }

/* Üzenet-lista: az utolsó válasz előnézete az eredeti alatt */
.msg-lastreply { margin-top:3px; font-size:12.5px; line-height:1.45; color:var(--muted,#6b7280); padding-left:10px; border-left:2px solid var(--border,#e4e8ee); }
.msg-lastreply b { color:var(--text,#1a2330); font-weight:600; }
/* Admin „Összes" nézet: riasztás-szekció címke */
.msg-sec-label { margin:16px 4px 8px; font-size:12px; font-weight:700; letter-spacing:.3px; color:var(--muted,#6b7280); text-transform:uppercase; }
