/* QQ Raktar - dizajnrendszer */
:root {
  --canvas: #F6F7F9;
  --surface: #FFFFFF;
  --subtle: #F2F4F7;
  --border: #E4E7EC;
  --border-strong: #D0D5DD;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #8A94A6;
  --side: #0C111D;
  --side-2: #161B26;
  --side-ink: #CECFD2;
  --side-mute: #85888E;
  --accent: #2E5BFF;
  --accent-ink: #1D3FD6;
  --accent-soft: #EEF2FF;
  --ok: #067647;
  --ok-soft: #ECFDF3;
  --warn: #B54708;
  --warn-soft: #FFFAEB;
  --risk: #D92D20;
  --risk-soft: #FEF3F2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18), 0 4px 8px -4px rgba(16, 24, 40, .06);
  --r: 10px;
  --f: "Geist", "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --side-w: 248px;
}
* { box-sizing: border-box; }
html { background: var(--canvas); color: var(--ink); }
body { margin: 0; font-family: var(--f); font-size: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chart svg, .minichart svg { stroke: none; stroke-width: 0; }
.chart svg text, .minichart svg text { font-family: var(--f); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; z-index: 30; }
.logo { display: flex; align-items: center; gap: 11px; padding: 20px 20px 22px; }
.logomark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: -.02em; }
.logo b { display: block; color: #fff; font-size: 15px; font-weight: 650; letter-spacing: -.01em; line-height: 1.2; }
.logo small { color: var(--side-mute); font-size: 12px; }
.side nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.navlabel { color: var(--side-mute); font-size: 12px; padding: 14px 10px 6px; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-weight: 500; }
.side nav a svg { width: 18px; height: 18px; color: var(--side-mute); flex: none; }
.side nav a:hover { background: var(--side-2); color: #fff; }
.side nav a.on { background: var(--side-2); color: #fff; }
.side nav a.on svg { color: #fff; }
.badge { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 99px; background: var(--risk); color: #fff; font-size: 11.5px; font-weight: 650; line-height: 20px; text-align: center; }
.logout { margin: auto 12px 8px; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--side-ink); font-weight: 500; text-align: left; }
.logout svg { width: 18px; height: 18px; color: var(--side-mute); }
.logout:hover { background: var(--side-2); color: #fff; }
.logout:not([hidden]) + .sidefoot { margin-top: 0; }
.sidefoot { margin-top: auto; padding: 16px 20px 20px; border-top: 1px solid #1F242F; font-size: 12.5px; color: var(--side-mute); line-height: 1.55; }
.sidefoot b { color: var(--side-ink); font-weight: 550; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #17B26A; margin-right: 7px; vertical-align: 1px; }
.dot.busy { background: #F79009; animation: pulse 1.2s infinite; }
.dot.err { background: #F04438; }
@keyframes pulse { 50% { opacity: .35; } }

.main { flex: 1; min-width: 0; margin-left: var(--side-w); display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 28px; background: rgba(246, 247, 249, .88); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.menubtn { display: none; background: none; border: 0; padding: 6px; border-radius: 8px; color: var(--ink-2); }
.menubtn svg { width: 22px; height: 22px; }
.gsearch { position: relative; flex: 1; max-width: 560px; }
.gsearch > svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.gsearch input { width: 100%; height: 40px; padding: 0 64px 0 38px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow); }
.gsearch input::placeholder { color: var(--ink-3); }
.gsearch input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.gsearch input::-webkit-search-cancel-button { display: none; }
.gsearch kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 500 11.5px var(--f); color: var(--ink-3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; background: var(--subtle); }
.gres { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 70vh; overflow-y: auto; }
.gres .grp { font-size: 12px; color: var(--ink-3); padding: 8px 10px 4px; }
.gres .it { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 8px; }
.gres .it.on, .gres .it:hover { background: var(--subtle); }
.gres .it img, .gres .it .ph { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; background: var(--subtle); flex: none; }
.gres .it .t { flex: 1; min-width: 0; }
.gres .it .t b { display: block; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gres .it .t small { color: var(--ink-3); font-size: 12.5px; }
.gres .it .r { color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
.gres .empty { padding: 14px 10px; color: var(--ink-3); }
.topright { margin-left: auto; display: flex; gap: 10px; }

.notice { margin: 16px 28px 0; padding: 11px 14px; border: 1px solid #FEDF89; background: var(--warn-soft); color: #93370D; border-radius: 9px; font-size: 13.5px; }
.notice.err { border-color: #FECDCA; background: var(--risk-soft); color: #912018; }
#page { padding: 26px 28px 64px; max-width: 1560px; width: 100%; }

/* nyelvvalaszto */
.lang { position: relative; }
.flag { width: 22px; height: 15px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(16, 24, 40, .14); flex: none; stroke: none; display: block; }
.langbtn { padding: 0 10px; gap: 8px; }
.langbtn span { font-weight: 600; font-size: 13px; }
.langbtn > svg:not(.flag) { width: 14px; height: 14px; color: var(--ink-3); }
.langmenu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 176px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 25; }
.langmenu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; text-align: left; font-weight: 500; }
.langmenu button:hover { background: var(--subtle); }
.langmenu button[aria-checked=true] { font-weight: 650; }
.langmenu button span { flex: 1; }
.langmenu button > svg:not(.flag) { width: 16px; height: 16px; color: var(--accent); }

/* keszlethiany-veszely: kis piros jeloles */
.riskdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--risk); box-shadow: 0 0 0 3px var(--risk-soft); margin-right: 8px; vertical-align: 1px; flex: none; }
.t tbody tr.atrisk > td:first-child { box-shadow: inset 3px 0 0 var(--risk); }
.legendline { margin: -4px 0 12px; color: var(--ink-2); font-size: 13px; }

/* ---------- Buttons, inputs ---------- */
.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 9px; font-weight: 550; border: 1px solid transparent; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn.primary:hover { background: var(--accent-ink); }
.btn.ghost { background: var(--surface); border-color: var(--border); color: var(--ink); box-shadow: var(--shadow); }
.btn.ghost:hover { border-color: var(--border-strong); background: #FCFCFD; }
.btn.danger { background: var(--surface); border-color: #FDA29B; color: var(--risk); }
.btn.danger:hover { background: var(--risk-soft); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.inp, .sel { height: 38px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow); }
.sel { padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A94A6' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; max-width: 172px; text-overflow: ellipsis; }
.inp:focus, .sel:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.searchbox { position: relative; }
.searchbox svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.searchbox .inp { padding-left: 34px; width: 236px; }

.seg { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; background: var(--subtle); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; height: 30px; padding: 0 12px; border-radius: 7px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }
.seg button .n { color: var(--ink-3); margin-left: 5px; font-weight: 500; }
.lab { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }
.lab .inp { width: 74px; text-align: right; }

/* ---------- Page header ---------- */
.ph-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.ph-row h1 { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }
.ph-row p { margin: 4px 0 0; color: var(--ink-2); max-width: 72ch; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }

/* ---------- Cards, KPIs ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card-h h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card-h a, .linkbtn { color: var(--accent); font-weight: 550; text-decoration: none; background: none; border: 0; padding: 0; font-size: 13px; }
.card-h a:hover, .linkbtn:hover { color: var(--accent-ink); text-decoration: underline; }
.card-b { padding: 14px 18px 18px; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; }
.kpi .k { color: var(--ink-2); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi .k i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.kpi .v { font-size: 26px; font-weight: 650; letter-spacing: -.025em; margin-top: 6px; line-height: 1.15; white-space: nowrap; }
.kpi .s { color: var(--ink-3); font-size: 12.5px; margin-top: 3px; }
.kpi.risk .v { color: var(--risk); }
.kpi.click { cursor: pointer; transition: border-color .12s; }
.kpi.click:hover { border-color: var(--border-strong); }
.grid2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }

/* chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 240px; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; padding: 7px 10px; border-radius: 8px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -10px; box-shadow: var(--shadow-lg); }
.chart .tip b { display: block; font-size: 14px; }
.chart-meta { display: flex; gap: 28px; margin-bottom: 6px; flex-wrap: wrap; }
.chart-meta div b { display: block; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.chart-meta div span { color: var(--ink-2); font-size: 12.5px; }
.delta { font-size: 12.5px; font-weight: 600; margin-left: 6px; }
.delta.up { color: var(--ok); } .delta.down { color: var(--risk); }

/* status distribution */
.stack { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--subtle); margin: 4px 0 16px; }
.stack i { display: block; height: 100%; }
.legend-list { display: flex; flex-direction: column; }
.legend-list button { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; border-radius: 0; }
.legend-list button:last-child { border-bottom: 0; }
.legend-list button:hover span { color: var(--accent); }
.legend-list i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-list span { flex: 1; color: var(--ink-2); }
.legend-list b { font-weight: 600; }

/* ranking list */
.rank { display: flex; flex-direction: column; gap: 2px; }
.rank button { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 4px; border: 0; background: none; text-align: left; border-radius: 8px; }
.rank button:hover { background: var(--subtle); }
.rank img, .rank .ph { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; background: var(--subtle); }
.rank .t b { display: block; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .bar { height: 4px; border-radius: 4px; background: var(--subtle); margin-top: 5px; }
.rank .bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.rank .r { font-weight: 600; text-align: right; white-space: nowrap; }
.rank .r small { display: block; color: var(--ink-3); font-weight: 400; font-size: 12px; }

/* ---------- Tables ---------- */
.tcard { overflow: hidden; }
.tscroll { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
.t th { position: sticky; top: 0; background: #F9FAFB; text-align: left; font-weight: 550; font-size: 12.5px; color: var(--ink-2); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; }
.t th.sort { cursor: pointer; }
.t th.sort:hover { color: var(--ink); }
.t th .ar { display: inline-block; width: 10px; color: var(--accent); }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tbody tr:last-child td { border-bottom: 0; }
.t tbody tr.row { cursor: pointer; }
.t tbody tr.row:hover td { background: #FAFBFC; }
.t tbody tr.sel td { background: var(--accent-soft); }
.t .num { text-align: right; white-space: nowrap; }
.t .neg { color: var(--risk); font-weight: 600; }
.sub { display: block; color: var(--ink-3); font-size: 12px; font-weight: 400; line-height: 1.3; }
.t .chk { width: 40px; padding-right: 0; }
.t input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.muted { color: var(--ink-3); }
.prod { display: flex; align-items: center; gap: 12px; min-width: 230px; }
.prod img, .prod .ph { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--subtle); border: 1px solid var(--border); flex: none; }
.prod .pn { font-weight: 550; max-width: 34ch; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod .ps { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 550; white-space: nowrap; border: 1px solid transparent; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: #ABEFC6; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: #FEDF89; }
.chip.risk { background: var(--risk-soft); color: var(--risk); border-color: #FECDCA; }
.chip.info { background: var(--accent-soft); color: var(--accent-ink); border-color: #C7D2FE; }
.chip.neutral { background: var(--subtle); color: var(--ink-2); border-color: var(--border); }
.run { width: 140px; }
.run .tr { position: relative; height: 6px; border-radius: 6px; background: var(--subtle); }
.run .tr i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: #17B26A; }
.run.warn .tr i { background: #F79009; }
.run.risk .tr i { background: var(--risk); }
.run .tr u { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 2px; background: var(--ink); opacity: .55; }
.run .l { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; line-height: 1.3; }
.run.risk .l { color: var(--risk); font-weight: 550; }
.boxv b { font-size: 16px; font-weight: 650; }
.boxv small { display: block; color: var(--ink-3); font-size: 12px; }
.tfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--ink-2); font-size: 13px; flex-wrap: wrap; }
.pager { display: flex; gap: 6px; align-items: center; }
.empty-state { padding: 56px 20px; text-align: center; color: var(--ink-2); }
.empty-state b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* summary strip */
.strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 16px; }
.strip > div { padding: 14px 18px; border-left: 1px solid var(--border); }
.strip > div:first-child { border-left: 0; }
.strip span { color: var(--ink-2); font-size: 12.5px; }
.strip b { display: block; font-size: 20px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
.strip .risk b { color: var(--risk); }

/* selection bar */
.selbar { position: sticky; bottom: 18px; z-index: 15; margin-top: 16px; display: flex; align-items: center; gap: 16px; padding: 12px 14px 12px 18px; background: var(--ink); color: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); flex-wrap: wrap; }
.selbar .grow { flex: 1; }
.selbar b { font-weight: 650; }
.selbar .btn.ghost { background: transparent; color: #fff; border-color: #344054; box-shadow: none; }
.selbar .btn.ghost:hover { background: #1D2939; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 12px; color: var(--ink-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs button .n { margin-left: 6px; font-size: 12px; padding: 1px 7px; border-radius: 99px; background: var(--subtle); color: var(--ink-2); }
.tabs button.on .n { background: var(--accent-soft); color: var(--accent-ink); }
.tabdesc { color: var(--ink-2); margin: -4px 0 14px; max-width: 80ch; }

/* ABC */
.abc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.abc .card { padding: 16px 18px; position: relative; }
.abc .abcx { position: absolute; top: 14px; right: 14px; }
.abc .cls { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; font-weight: 700; margin-bottom: 10px; }
.abc .A .cls { background: var(--accent-soft); color: var(--accent-ink); }
.abc .B .cls { background: var(--warn-soft); color: var(--warn); }
.abc .C .cls { background: var(--subtle); color: var(--ink-2); }
.abc b.v { display: block; font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.abc p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.share { height: 6px; border-radius: 6px; background: var(--subtle); margin-top: 12px; overflow: hidden; }
.share i { display: block; height: 100%; background: var(--accent); }
.abc .B .share i { background: #F79009; } .abc .C .share i { background: #98A2B3; }
.clsb { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-weight: 700; font-size: 12.5px; }
.clsb.A { background: var(--accent-soft); color: var(--accent-ink); } .clsb.B { background: var(--warn-soft); color: var(--warn); } .clsb.C { background: var(--subtle); color: var(--ink-2); }

/* settings */
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 550; font-size: 13.5px; }
.field small { color: var(--ink-3); font-size: 12.5px; }
.field .inp { width: 140px; }

/* ---------- Drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(16, 24, 40, .38); z-index: 40; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 100vw); background: var(--surface); z-index: 41; overflow-y: auto; box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
.drawer.open { transform: none; }
.drawer .close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 20px; line-height: 1; color: var(--ink-2); z-index: 2; }
.drawer .close:hover { background: var(--subtle); }
.dhead { display: flex; gap: 16px; padding: 24px 64px 18px 26px; border-bottom: 1px solid var(--border); }
.dhead img, .dhead .ph { width: 88px; height: 88px; border-radius: 12px; object-fit: cover; background: var(--subtle); border: 1px solid var(--border); flex: none; }
.dhead h2 { margin: 0 0 4px; font-size: 19px; font-weight: 650; letter-spacing: -.015em; line-height: 1.3; }
.dhead .meta { color: var(--ink-3); font-size: 13px; }
.dhead .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.dbody { padding: 18px 26px 32px; }
.dkpi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.dkpi > div { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.dkpi span { color: var(--ink-2); font-size: 12.5px; }
.dkpi b { display: block; font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
.dkpi .risk b { color: var(--risk); }
.dkpi .acc { background: var(--accent-soft); border-color: #C7D2FE; }
.dkpi .acc b { color: var(--accent-ink); }
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--risk-soft); border: 1px solid #FECDCA; color: #912018; margin-bottom: 18px; font-size: 13.5px; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert.info { background: var(--accent-soft); border-color: #C7D2FE; color: #1D3FD6; }
.steps { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.steps > div { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: baseline; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.steps > div:last-child { border-bottom: 0; }
.steps .no { color: var(--ink-3); font-size: 12.5px; }
.steps small { display: block; color: var(--ink-3); font-size: 12.5px; }
.steps b { font-weight: 600; white-space: nowrap; }
.steps .res { background: var(--accent-soft); }
.steps .res b { color: var(--accent-ink); font-size: 16px; }
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.dl span { color: var(--ink-2); }
.dl b { font-weight: 550; text-align: right; }
.dactions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.minichart svg { display: block; width: 100%; height: 150px; }
.mlegend { display: flex; gap: 16px; color: var(--ink-2); font-size: 12.5px; margin-top: 8px; flex-wrap: wrap; }
.mlegend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* form */
.form { padding: 24px 26px 32px; }
.form h2 { margin: 0 0 4px; font-size: 20px; font-weight: 650; letter-spacing: -.015em; }
.form > p { margin: 0 0 22px; color: var(--ink-2); }
.fgroup { margin-bottom: 22px; }
.fgroup h3 { margin: 0 0 12px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.fgrid .wide { grid-column: 1 / -1; }
.ff { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 550; color: var(--ink); }
.ff .req::after { content: " *"; color: var(--risk); }
.ff input, .ff textarea { height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font-weight: 400; box-shadow: var(--shadow); }
.ff textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.ff input:focus, .ff textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ff input[aria-invalid=true] { border-color: var(--risk); }
.ff .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.upload { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: 10px; background: #FCFCFD; }
.upload img, .upload .ph { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--subtle); flex: none; }
.upload .ut { flex: 1; font-size: 13px; color: var(--ink-2); }
.upload .ut b { display: block; color: var(--ink); font-weight: 550; }
.ferr { color: var(--risk); min-height: 20px; font-size: 13.5px; margin: 4px 0 10px; }
.fbar { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 14px 0 0; background: var(--surface); }

/* order draft */
.ord td .inp { width: 84px; height: 34px; text-align: right; }
.ordtot { display: flex; justify-content: flex-end; gap: 28px; padding: 14px 4px; font-size: 13.5px; color: var(--ink-2); }
.ordtot b { color: var(--ink); font-size: 18px; font-weight: 650; display: block; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-weight: 550; z-index: 60; box-shadow: var(--shadow-lg); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } .strip > div:nth-child(4) { border-left: 0; } }
@media (max-width: 1080px) {
  .grid2 { grid-template-columns: 1fr; }
  .set-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .menubtn { display: block; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topright .btn span { display: none; }
  .topright .btn { padding: 0 10px; }
  .langbtn > svg:not(.flag) { display: none; }
  .gsearch kbd { display: none; }
  .gsearch input { padding-right: 12px; }
  #page { padding: 18px 14px 56px; }
  .notice { margin: 12px 14px 0; }
}
@media (max-width: 640px) {
  #syncBtn { display: none; }
  .topright { gap: 8px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .v { font-size: 21px; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip > div { border-left: 0; border-top: 1px solid var(--border); }
  .strip > div:nth-child(-n+2) { border-top: 0; }
  .strip > div:last-child { grid-column: 1 / -1; }
  .abc { grid-template-columns: 1fr; }
  .searchbox .inp { width: 100%; }
  .searchbox { flex: 1 1 100%; }
  .fgrid, .dl { grid-template-columns: 1fr; }
  .dkpi { grid-template-columns: 1fr 1fr; }
  .dhead { padding: 20px 56px 16px 18px; } .dbody, .form { padding-left: 18px; padding-right: 18px; }
  .dhead img, .dhead .ph { width: 64px; height: 64px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 8px; }
  .ph-row h1 { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) { .drawer, .side { transition: none; } .dot.busy { animation: none; } }


/* ---------- Tapados szurosav + tablazatfejlec (asztali meret) ---------- */
@media (min-width: 901px) {
  #page .toolbar { position: sticky; top: 64px; z-index: 15; margin: -10px -28px 6px; padding: 10px 28px; background: rgba(246, 247, 249, .94); backdrop-filter: saturate(1.4) blur(10px); }
  #page .toolbar.stuck { box-shadow: 0 1px 0 var(--border); }
}
@media (min-width: 1360px) {
  /* szeles kepernyon a tablazat elfer, igy a fejlec az oldallal egyutt tapadhat */
  #page .tcard { overflow: clip; }
  #page .tscroll { overflow: visible; }
  #page .t th { top: calc(64px + var(--tbh, 0px)); z-index: 5; box-shadow: 0 1px 0 var(--border); }
}

/* ---------- Print: fekete-feher ---------- */
@media print {
  html, body { background: #fff; color: #000; }
  .side, .topbar, .notice, .toolbar, .selbar, .legendline, .drawer, .scrim, .ph-actions, .tfoot .pager, .t .chk, .toast { display: none !important; }
  .main { margin: 0; } #page { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
  .t th { background: #fff; color: #000; border-bottom: 1px solid #000; position: static; }
  .t td { border-bottom: 1px solid #999; color: #000; }
  .prod img, .prod .ph { display: none; }
  .chip { border: 1px solid #000 !important; background: #fff !important; color: #000 !important; }
  .run .tr { background: #ddd; } .run .tr i { background: #000 !important; } .run .l, .run.risk .l, .muted, .prod .ps { color: #000; }
  .strip b, .strip .risk b { color: #000; }
}
/* allapot szerinti csoportfejlec a tablazatokban */
.t tbody tr.grp td { background: #F2F4F7; padding: 7px 12px; border-bottom: 1px solid var(--border); }
.t tbody tr.grp .chip { margin-right: 8px; }
.t tbody tr.grp .muted { font-size: 12.5px; }
@media print { .t tbody tr.grp td { background: #fff; border-bottom: 1px solid #000; font-weight: bold; } }
/* Termekek: hogy a szurosav es az Excel gomb egy sorban maradjon 1440 px-en */
@media (min-width: 901px) { #tmQ { width: 214px; } #tmSt { max-width: 160px; } }
/* Beszerzesi tervezo: az Allapot oszlop is kiferjen */
#tvT th, #tvT td { padding-left: 9px; padding-right: 9px; }

/* ---------- Sotet mod (a valasztast a bongeszo jegyzi meg; nyomtatasnal mindig vilagos) ---------- */
.themebtn { width: 38px; padding: 0; justify-content: center; }
.themebtn svg { width: 17px; height: 17px; }
@media screen {
  html[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #0B0F17;
    --surface: #121826;
    --subtle: #1A2232;
    --border: #252E3F;
    --border-strong: #364156;
    --ink: #E8EBF1;
    --ink-2: #A9B1C0;
    --ink-3: #7C8699;
    --side: #070A11;
    --side-2: #151B28;
    --accent: #5B7FFF;
    --accent-ink: #A3B8FF;
    --accent-soft: rgba(91, 127, 255, .15);
    --ok: #47CD89;
    --ok-soft: rgba(23, 178, 106, .14);
    --warn: #F7B144;
    --warn-soft: rgba(247, 144, 9, .13);
    --risk: #F97066;
    --risk-soft: rgba(240, 68, 56, .15);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px -8px rgba(0, 0, 0, .6), 0 4px 8px -4px rgba(0, 0, 0, .4);
  }
  html[data-theme="dark"] .topbar { background: rgba(11, 15, 23, .86); }
  html[data-theme="dark"] #page .toolbar { background: rgba(11, 15, 23, .92); }
  html[data-theme="dark"] .t th { background: var(--subtle); }
  html[data-theme="dark"] .t tbody tr.row:hover td { background: #172033; }
  html[data-theme="dark"] .t tbody tr.grp td { background: #161E2D; }
  html[data-theme="dark"] .btn.ghost:hover { background: var(--subtle); }
  html[data-theme="dark"] .btn.danger { border-color: rgba(249, 112, 102, .45); }
  html[data-theme="dark"] .upload { background: var(--subtle); }
  html[data-theme="dark"] .chip.ok { border-color: rgba(71, 205, 137, .35); }
  html[data-theme="dark"] .chip.warn { border-color: rgba(247, 177, 68, .35); }
  html[data-theme="dark"] .chip.risk { border-color: rgba(249, 112, 102, .4); }
  html[data-theme="dark"] .chip.info, html[data-theme="dark"] .dkpi .acc { border-color: rgba(91, 127, 255, .4); }
  html[data-theme="dark"] .notice { border-color: rgba(247, 177, 68, .35); color: var(--warn); }
  html[data-theme="dark"] .notice.err, html[data-theme="dark"] .alert { border-color: rgba(249, 112, 102, .4); color: #FDA29B; }
  html[data-theme="dark"] .alert.info { border-color: rgba(91, 127, 255, .4); color: var(--accent-ink); }
  html[data-theme="dark"] .toast, html[data-theme="dark"] .selbar, html[data-theme="dark"] .chart .tip { background: #2A3346; color: #F2F4F7; }
  html[data-theme="dark"] .chart line { stroke: #222B3B; }
  html[data-theme="dark"] .chart svg text, html[data-theme="dark"] .minichart svg text { fill: var(--ink-3); }
  html[data-theme="dark"] .chart #hc { fill: var(--surface); }
  html[data-theme="dark"] .minichart rect[fill="#FEE4E2"] { fill: rgba(240, 68, 56, .22); }
  html[data-theme="dark"] .run .tr { background: var(--subtle); }
}
.mlegend i.kiesett { background: #FEE4E2; border: 1px solid #FDA29B; }
@media screen { html[data-theme="dark"] .mlegend i.kiesett { background: rgba(240, 68, 56, .22); border-color: rgba(249, 112, 102, .5); } }

/* ---------- Lejarat, beszallitoi rendeles, erkezesi datum, uj termek ---------- */
.side nav a .badge + .badge { margin-left: 4px; }
.badge.warnb { background: #F79009; }
.strip.s4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
label.chk { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13.5px; cursor: pointer; user-select: none; }
label.chk input { width: 16px; height: 16px; accent-color: var(--accent); }
.inp.sm { height: 32px; padding: 0 8px; font-size: 13px; box-shadow: none; }
.nowrap { white-space: nowrap; }
.t .sub { display: block; }
.t.mini th { position: static; }
.t.mini td, .t.mini th { padding: 8px 10px; }
.bsrow { cursor: pointer; }
.bsrow.nyitva td { background: var(--accent-soft); }
.t tbody tr.bsdet > td { padding: 0 0 10px 18px; background: var(--subtle); }
.bsdet .t.mini { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.run .l.eta { color: var(--risk); font-weight: 550; }
.chip.ujjel { height: 18px; font-size: 11px; padding: 0 6px; }
.alert.lejsav { margin-bottom: 18px; background: var(--warn-soft); border-color: #FEDF89; color: #93370D; }
.alert.lejsav a { color: inherit; font-weight: 650; }
.etabox { margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--subtle); }
.etabox label { display: block; font-weight: 600; margin-bottom: 6px; }
.etarow { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.etabox small { color: var(--ink-2); font-size: 12.5px; }
@media screen {
  html[data-theme="dark"] .badge.warnb { background: #DC6803; }
  html[data-theme="dark"] .alert.lejsav { border-color: rgba(247, 177, 68, .35); color: var(--warn); }
}
@media (max-width: 900px) { .strip.s4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Kezi ellenorzes, tesztsav ---------- */
.boxv .kezichip { margin-top: 4px; height: 20px; font-size: 11.5px; padding: 0 7px; align-self: flex-end; cursor: help; }
.strip .sub { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; font-weight: 500; }
.tesztsav { margin: -8px 0 18px; padding: 10px 14px; border-radius: 10px; background: #FEF0C7; color: #93370D; border: 1px solid #FEDF89; font-weight: 600; font-size: 13.5px; }
@media screen { html[data-theme="dark"] .tesztsav { background: rgba(247, 144, 9, .13); color: var(--warn); border-color: rgba(247, 177, 68, .35); } }
@media print { .kezichip { border: 1px solid #000; } }
