:root {
  --bg: #000000;
  --panel: #2a2b36;
  --panel-2: #323440;
  --line: #3d3f4d;
  --text: #ffffff;
  --muted: #a3a6b8;
  --green: #1aa2d5; /* akcent = niebieski z logo Control Systems */
  --green-dark: #1586b0;
  --red: #ff3c3c;
  --orange: #ffb43c;
  --blue: #1aa2d5;
  --radius: 14px;
  --font: Montserrat, Arial, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 26px; font-weight: 800; margin: 0; letter-spacing: .2px; }
h2 { font-size: 16px; font-weight: 700; text-transform: uppercase; margin: 0 0 14px; letter-spacing: .4px; }
h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; margin: 0 0 8px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* layout */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { padding: 20px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; margin: 4px 6px 22px; font-weight: 800; font-size: 18px; }
.logo img { display: block; height: 46px; width: auto; }
.login .logo img { height: 78px; }
.login.register .logo img { height: 64px; }
.mobile-bar .logo img { height: 34px; }
.mobile-bar .logo { margin: 0; }
.side-card { background: var(--panel-2); border-radius: var(--radius); padding: 18px 14px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; margin: 0 auto 10px; color: var(--green); }
.hello { text-align: center; font-weight: 700; margin-bottom: 16px; }
.side-section { font-weight: 700; margin: 16px 4px 8px; font-size: 13px; }
.side-title { text-align: center; font-weight: 800; margin-bottom: 10px; }
.nav a, .nav button { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 7px 8px 7px 14px; margin-bottom: 6px;
  background: var(--bg); border: 0; border-radius: 999px; cursor: pointer; font-size: 13px; text-align: left; }
.nav a .dot, .nav button .dot { width: 18px; height: 18px; border-radius: 50%; background: #fff; color: var(--bg); display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.nav a.active { background: #fff; color: var(--bg); font-weight: 700; }
.nav a.active .dot { background: var(--bg); color: #fff; }
.nav button.logout .dot { background: var(--orange); }
.nav .lang.active { outline: 2px solid var(--green); }
.main { padding: 22px 28px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 2px solid var(--green); }
.topbar .spacer { flex: 1; }
.mobile-bar { display: none; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 18px; border-radius: 999px; border: 2px solid var(--green);
  background: transparent; cursor: pointer; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
.btn:hover { background: rgba(10, 219, 88, .12); }
.btn.solid { background: var(--green); color: var(--bg); }
.btn.solid:hover { background: var(--green-dark); }
.btn.danger { border-color: var(--red); }
.btn.danger:hover { background: rgba(255, 60, 60, .12); }
.btn.white { border-color: #fff; }
.btn.sm { height: 28px; padding: 0 12px; font-size: 11px; }
.btn:disabled { opacity: .5; cursor: default; }
.input, select.input, textarea.input { height: 38px; border-radius: 999px; border: 0; background: var(--panel-2); padding: 0 16px; width: 100%; outline: none; }
textarea.input { height: auto; min-height: 80px; border-radius: 16px; padding: 10px 16px; resize: vertical; }
.input:focus { box-shadow: 0 0 0 2px var(--green); }
.input.green { background: var(--green); color: var(--bg); font-weight: 600; }
.input.green::placeholder { color: rgba(30,30,39,.75); }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-weight: 700; font-size: 12px; margin: 0 0 6px 4px; }
.field-error { color: var(--red); font-size: 12px; margin: 4px 0 0 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { position: relative; }
.search .input { width: 240px; }

/* cards */
.card { background: var(--panel); border-radius: var(--radius); padding: 18px; }
.card.outline { background: transparent; border: 2px solid var(--line); }
.card.c-red { border-color: var(--red); }
.card.c-green { border-color: var(--green); }
.card.c-blue { border-color: var(--blue); }
.card.c-orange { border-color: var(--orange); }
.kpi { text-align: center; }
.kpi .label { font-size: 12px; font-weight: 600; min-height: 30px; }
.kpi .value { font-size: 40px; font-weight: 800; margin-top: 6px; }
.kpi.red .value { color: var(--red); } .kpi.green .value { color: var(--green); } .kpi.blue .value { color: var(--blue); } .kpi.orange .value { color: var(--orange); }
.big-green { color: var(--green); font-size: 28px; font-weight: 800; }
.section { margin-top: 22px; }
.green-panel { background: var(--green); color: var(--bg); border-radius: var(--radius); padding: 18px; }
.green-panel h2 { color: #fff; }
.green-panel .input { background: rgba(0,0,0,.18); color: #fff; }
.green-panel .btn { border-color: #fff; color: #fff; }

/* tables */
.table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; font-weight: 700; padding: 4px 12px; white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--green); }
.table td { background: var(--panel-2); padding: 11px 12px; font-size: 12px; }
.table tr td:first-child { border-radius: 10px 0 0 10px; }
.table tr td:last-child { border-radius: 0 10px 10px 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #3a3c4a; }
.table.compact td { padding: 7px 12px; }
.table-wrap { overflow-x: auto; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.pagination button { min-width: 32px; height: 32px; border-radius: 999px; border: 2px solid var(--line); background: transparent; cursor: pointer; }
.pagination button.active { border-color: var(--green); color: var(--green); font-weight: 700; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--bg); white-space: nowrap; }
.badge .d { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.badge.ok .d { background: var(--green); } .badge.ok { color: var(--green); }
.badge.err .d { background: var(--red); } .badge.err { color: var(--red); }
.badge.warn .d { background: var(--orange); } .badge.warn { color: var(--orange); }
.badge.off { color: var(--muted); }

/* tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 2px solid var(--green); padding-bottom: 6px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border-radius: 8px; padding: 7px 12px; font-size: 12px; font-weight: 600; }
.tabs a.active { background: var(--green); color: var(--bg); }
.tabs svg { width: 14px; height: 14px; }

/* gauges */
.gauges { display: flex; gap: 36px; flex-wrap: wrap; justify-content: center; }
.gauge { text-align: center; }
.gauge .ref { font-size: 13px; margin-bottom: 8px; }
.gauge svg { display: block; margin: 0 auto; }
.coins { display: flex; gap: 10px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.coin { text-align: center; font-size: 11px; }
.coin .c { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; font-weight: 800; margin: 4px auto; }

/* chart */
.chart { width: 100%; overflow-x: auto; }
.chart svg text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.legend { display: flex; gap: 14px; font-size: 12px; margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* misc */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.token-box { display: flex; gap: 8px; align-items: center; }
.token-box code { background: var(--panel-2); padding: 10px 14px; border-radius: 12px; flex: 1; overflow-wrap: anywhere; font-size: 12px; }
pre.json { background: var(--bg); border-radius: 10px; padding: 12px; overflow: auto; max-height: 320px; font-size: 11px; margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.alert { padding: 12px 16px; border-radius: 12px; background: rgba(255, 180, 60, .14); color: var(--orange); margin-bottom: 16px; font-weight: 600; }
.alert.err { background: rgba(255, 60, 60, .14); color: var(--red); }
.boxes-list { display: flex; flex-wrap: wrap; gap: 4px; }
.boxes-list span { background: var(--panel-2); border-radius: 6px; padding: 2px 7px; font-size: 11px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 400px; }
.login .logo { justify-content: center; font-size: 24px; margin-bottom: 40px; }
.login .input { margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 10px; margin: 6px 0 16px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--green); }
.langs { display: flex; gap: 12px; margin-top: 14px; }
.langs button { background: none; border: 0; cursor: pointer; padding: 0; font-weight: 600; }
.langs button.active { color: var(--green); }
.lang-picker { position: relative; width: 100%; }
.langs .lang-picker { max-width: 210px; }
.lang-picker .lang-current { justify-content: flex-start; margin: 0; display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 14px; border: 0; border-radius: 999px;
  background: var(--panel-2); color: #fff; font-weight: 600; font-size: 13px; cursor: pointer; text-align: left; }
.nav .lang-picker .lang-current { background: var(--bg); }
.langs .lang-picker .lang-current { background: var(--panel-2); padding: 0 14px; }
.lang-current span { flex: 1; }
.lang-current .chev { color: var(--green); transition: transform .15s; }
.lang-current[aria-expanded="true"] .chev { transform: rotate(180deg); }
.lang-current:focus-visible, .lang-menu button:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.flag { width: 22px; height: 15px; border-radius: 3px; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.lang-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 60; margin: 0; padding: 6px; list-style: none;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.lang-picker .lang-menu button { justify-content: flex-start; margin: 0; height: auto; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px;
  background: none; color: #fff; font-size: 13px; font-weight: 500; cursor: pointer; text-align: left; }
.lang-picker .lang-menu button:hover { background: rgba(255,255,255,.07); }
.lang-picker .lang-menu button.active { color: var(--green); font-weight: 700; }

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border-radius: var(--radius); padding: 22px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; }
#toast div { background: var(--panel-2); border-left: 4px solid var(--green); padding: 12px 18px; border-radius: 10px; margin-top: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
#toast div.err { border-color: var(--red); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin 1s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .grid4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; inset: 0; z-index: 40; background: var(--bg); height: 100vh; }
  .sidebar.open { display: block; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .mobile-bar button { background: none; border: 0; cursor: pointer; }
  .main { padding: 16px 16px 60px; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .search .input { width: 100%; }
  .search { flex: 1; }
  .kpi .value { font-size: 32px; }
  h1 { font-size: 20px; }
}

/* debug komunikacji */
.table.comm > tbody > tr > td { vertical-align: top; }
.table.comm > tbody > tr.lvl-error > td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.table.comm > tbody > tr.lvl-warn > td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
.table.comm > tbody > tr.lvl-ok > td:first-child { box-shadow: inset 3px 0 0 var(--green); }
.table tr.details-row td { background: var(--bg); border-radius: 10px; padding: 14px; }
.comm-details h3 { margin-top: 4px; }
.dg-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.dg-list li { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.5; }
.dg-list .badge { margin-right: 6px; }
.dg-list li.dg-error { border-left: 3px solid var(--red); }
.dg-list li.dg-warn { border-left: 3px solid var(--orange); }
.dg-list li.dg-ok { border-left: 3px solid var(--green); }
.row-warn td { color: var(--orange); }
.nowrap { white-space: nowrap; }
.table.comm { table-layout: fixed; min-width: 900px; }
.table.comm > tbody > tr > td { overflow-wrap: anywhere; }
.comm-details .table td { padding: 5px 10px; }
.comm-details pre.json { white-space: pre-wrap; word-break: break-all; max-height: 360px; }
.comm-details .table-wrap { max-height: 420px; overflow: auto; }

/* dostęp */
.access-grid { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
.access-list { max-height: 75vh; overflow-y: auto; }
.aitem { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--panel-2); border: 2px solid transparent;
  border-radius: 12px; padding: 9px 12px; margin-bottom: 6px; cursor: pointer; font-size: 13px; }
.aitem:hover { border-color: var(--line); }
.aitem.active { border-color: var(--green); }
.aitem .aside { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.atabs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.atab { display: grid; grid-template-columns: 22px 22px 1fr; grid-template-rows: auto auto; gap: 2px 10px; align-items: center; background: var(--panel-2);
  border-radius: 12px; padding: 12px 14px; cursor: pointer; border: 2px solid transparent; }
.atab:has(input:checked) { border-color: var(--green); }
.atab input { width: 20px; height: 20px; accent-color: var(--green); grid-row: span 2; }
.atab .ticon { grid-row: span 2; color: var(--muted); }
.atab .ticon svg { width: 18px; height: 18px; }
.atab .tname { font-weight: 700; }
.atab .tsrc { grid-column: 3; }
.atab.locked { opacity: .6; cursor: default; }
.amatrix th { text-align: center; white-space: normal; font-size: 10px; }
.amatrix td.c { text-align: center; }
.amatrix .yes { color: var(--green); font-weight: 800; }
.amatrix .no { color: var(--muted); }
.amatrix .ov { color: var(--orange); font-size: 9px; margin-left: 3px; vertical-align: super; }
@media (max-width: 860px) { .access-grid { grid-template-columns: 1fr; } }

/* rejestracja / zatwierdzanie */
.login.register { max-width: 520px; }
.login.register .logo { margin-bottom: 20px; }
.login.register .input { margin-bottom: 0; }
.nav a .dot.pending { background: var(--orange); color: var(--bg); width: auto; min-width: 18px; padding: 0 5px; border-radius: 9px; }
.approve-card { border: 2px solid var(--orange); }
.ap-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; max-height: 260px; overflow-y: auto; }
.ap-item { display: flex; align-items: center; gap: 8px; background: var(--panel-2); border-radius: 10px; padding: 8px 10px; cursor: pointer; border: 2px solid transparent; flex-wrap: wrap; }
.ap-item:has(input:checked) { border-color: var(--green); }
.ap-item input { width: 18px; height: 18px; accent-color: var(--green); }

/* ---- zakładka Temperatura ---- */
.temp-form { display: grid; gap: 14px; }
.temp-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; }
.temp-row .field { margin: 0; }
.temp-row input[type=date] { width: 160px; }
.seg { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; color: #fff; padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; }
.seg button.active { background: var(--green); color: #000; }
.sensor-checks { display: flex; gap: 10px; flex-wrap: wrap; }
.sensor-check { display: inline-flex; align-items: center; gap: 8px; background: var(--bg); padding: 9px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px; user-select: none; }
.sensor-check input { accent-color: var(--green); width: 16px; height: 16px; margin: 0; }
.sensor-check i, .legend i.sw, .temp-sum i.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.temp-sum i.sw { margin-right: 8px; vertical-align: -1px; }
.legend i.dash { width: 18px; height: 0; border-top: 2px dashed var(--muted); border-radius: 0; background: none; }
.temp-chart { margin-top: 12px; }
.tc-wrap { position: relative; }
.tc-wrap svg { display: block; width: 100%; height: auto; min-width: 640px; }
.tc-line { position: absolute; top: 14px; bottom: 40px; width: 1px; background: rgba(255,255,255,.35); pointer-events: none; }
.tc-tip { position: absolute; pointer-events: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px; white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.45); z-index: 5; }
.tc-tip div { margin-top: 3px; }
.tc-tip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.temp-sum td, .temp-sum th { white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---- Informacje ---- */
.nav a.info-link { margin-top: 8px; }
.nav a.info-link svg { width: 16px; height: 16px; margin-right: 8px; flex: none; }
.nav a.info-link { justify-content: flex-start; }
.nav a.info-link .dot { margin-left: auto; }
.help-layout { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
.help-toc { position: sticky; top: 16px; display: grid; gap: 2px; }
.help-toc a { padding: 7px 10px; border-radius: 10px; font-size: 13px; color: #fff; text-decoration: none; }
.help-toc a:hover { background: rgba(255,255,255,.06); color: var(--green); }
.help-toc .badge, .help-sec h2 .badge { font-size: 9px; padding: 1px 7px; color: var(--orange); vertical-align: middle; }
.help-intro { font-size: 15px; line-height: 1.6; margin: 0 0 16px; }
.help-sec { margin-bottom: 14px; scroll-margin-top: 16px; line-height: 1.6; font-size: 14px; }
.help-sec h2 { margin-top: 0; }
.help-sec li { margin-bottom: 6px; }
.help-sec code { background: var(--bg); padding: 1px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }
.help-sec a { color: var(--green); }
@media (max-width: 900px) { .help-layout { grid-template-columns: 1fr; } .help-toc { position: static; } }

/* ---- Konfiguracja automatu ---- */
.products-table td { vertical-align: middle; }
.products-table .input { height: 34px; background: var(--bg); }
.boxes-list span small { display: block; font-size: 9px; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.input.bad { box-shadow: 0 0 0 2px var(--red); }
.icon-btn { width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center; font-size: 18px; line-height: 1; }
.products-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.modal.wide { max-width: 900px; }
.qr-grid { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; }
.qr-item { margin: 0; text-align: center; font-size: 12px; color: var(--muted); }
.qr-item svg { display: block; border-radius: 10px; margin-bottom: 6px; max-width: 100%; height: auto; }

/* ---- Zestaw (generator wyglądu) ---- */
.layout-grid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.palette { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.fam-seg { flex-wrap: wrap; border-radius: 14px; margin-bottom: 10px; }
.fam-seg button { padding: 6px 10px; font-size: 12px; }
.pal-list { display: grid; gap: 6px; }
.pal-item { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid transparent; border-radius: 12px; padding: 6px 10px; color: #fff; cursor: pointer; text-align: left; font-size: 12.5px; }
.pal-item:hover { border-color: var(--green); }
.pal-item > span:nth-child(2) { display: grid; gap: 2px; flex: 1; }
.pal-thumb { width: 40px; height: 60px; display: grid; place-items: end center; flex: none; }
.pal-thumb svg { max-width: 40px; max-height: 60px; width: auto; height: auto; }
.pal-item .cool { color: #1aa2d5; }
.stage { overflow-x: auto; padding: 14px 4px 8px; margin-top: 8px; background: repeating-linear-gradient(0deg, transparent 0 23px, rgba(255,255,255,.03) 23px 24px); border-radius: 12px; }
.stage-row { display: flex; align-items: flex-end; gap: 4px; min-width: max-content; padding: 0 8px; }
.mod { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mod svg { display: block; }
.mod-name { font-size: 11px; color: var(--muted); white-space: nowrap; }
.mod-tools { display: flex; gap: 4px; opacity: .55; transition: opacity .15s; }
.mod:hover .mod-tools, .mod:focus-within .mod-tools { opacity: 1; }
.mod-tools button { background: var(--panel-2); border: 0; color: #fff; border-radius: 6px; width: 26px; height: 22px; cursor: pointer; font-size: 11px; }
.mod-tools button:disabled { opacity: .3; cursor: default; }
.mod-tools button.rm:hover { background: var(--red); }
.cell { cursor: pointer; }
.cell:hover rect:first-child, .cell:focus rect:first-child { stroke: #fff; stroke-width: 2; }
.cell:focus { outline: none; }
.cell-pop { position: absolute; z-index: 80; width: 210px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.cell-pop .input { margin-top: 4px; }
.zoom { display: inline-flex; gap: 4px; }
#lleg i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
@media (max-width: 1000px) { .layout-grid { grid-template-columns: 1fr; } .palette { position: static; max-height: none; } }

.home-stage { margin-top: 6px; }
.home-stage .cell { cursor: default; }
.home-stage .cell.has-num { cursor: pointer; }
.home-stage .cell.has-num:hover rect:first-child, .home-stage .cell.has-num:focus rect:first-child { stroke: #fff; stroke-width: 2; }
.home-stage .cell:hover rect:first-child { stroke-width: 1.2; }
.cu-add, .irm { cursor: pointer; }
.cu-add:hover rect { fill: rgba(26,162,213,.3); }
.cu-pick { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.home-stage { display: flex; }
.home-stage .stage-row { margin: 0 auto; }

.kpi-btn { width: 100%; cursor: pointer; font: inherit; color: inherit; text-align: center; background: transparent; transition: background .15s, transform .1s; }
.kpi-btn:hover { background: rgba(255,255,255,.04); }
.kpi-btn:active { transform: scale(.99); }
.kpi-more { font-size: 11px; color: var(--muted); margin-top: 4px; }
.box-chips { display: flex; flex-wrap: wrap; gap: 8px; max-height: 60vh; overflow-y: auto; }
.box-chip { display: grid; gap: 2px; min-width: 64px; max-width: 200px; padding: 8px 12px; border-radius: 10px; background: var(--bg); border-left: 3px solid var(--muted); }
.box-chip b { font-size: 16px; }
.box-chip span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.box-chip small { font-size: 11px; color: var(--muted); }
.box-chip.st-sold { border-left-color: var(--red); }
.box-chip.st-sale { border-left-color: #0adb58; }
.box-chip.st-order { border-left-color: #1aa2d5; }

/* ---- Powiadomienia ---- */
.switch-row { display: flex; gap: 14px; align-items: center; cursor: pointer; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--green); }
.switch-row > span { display: grid; gap: 2px; }
.notif-matrix th.c, .notif-matrix td.c { text-align: center; width: 150px; }
.big-check { width: 20px; height: 20px; accent-color: var(--green); cursor: pointer; }
.notif-autos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; margin-top: 10px; padding: 12px; background: var(--bg); border-radius: 12px; }

.tabs a.tab-link { border: 1px dashed var(--line); }

.wide-btn { width: 100%; padding: 14px; font-size: 14px; }
.txb-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.txb-filters .input { width: auto; min-width: 150px; flex: 1 1 160px; }
.txb-range { display: inline-flex; gap: 4px; flex: 1 1 240px; }
.txb-range .input { min-width: 0; }
.txb-sum { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; }
.txb-table tr.unsel td { opacity: .45; }
.txb-table th.num, .txb-table td.num { text-align: right; }
/* liczba zamkniętych szafek – zieleń Control Systems */
.kpi.cs-green { border-color: #0adb58 !important; }
.kpi.cs-green .value, .kpi.cs-green .label { color: #0adb58; }
.kpi.cs-green .kpi-more { color: rgba(10,219,88,.8); }

.box-pop { position: absolute; z-index: 90; min-width: 220px; max-width: 280px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: 0 12px 32px rgba(0,0,0,.55); font-size: 13px; }
.box-pop-x { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; }
.box-pop-num { font-size: 13px; color: var(--muted); }
.box-pop-num b { font-size: 22px; color: #fff; margin-left: 4px; }
.box-pop-st { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 6px 0 10px; }
.box-pop-st .d { width: 10px; height: 10px; border-radius: 50%; }
.box-pop-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-top: 1px solid var(--line); }
.box-pop-row span { color: var(--muted); }
.box-pop-row b { text-align: right; }

.badge.cs-sale { color: #0adb58; } .badge.cs-sale .d { background: #0adb58; }
.badge.cs-order { color: #1aa2d5; } .badge.cs-order .d { background: #1aa2d5; }

/* ---- Status podzespołów ---- */
.comp-summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: 14px; background: var(--panel); font-weight: 700; }
.comp-summary .d { width: 12px; height: 12px; border-radius: 50%; }
.comp-summary.st-ok .d { background: #0adb58; } .comp-summary.st-ok { color: #0adb58; }
.comp-summary.st-warn .d { background: #ffb43c; } .comp-summary.st-warn { color: #ffb43c; }
.comp-summary.st-error .d { background: #ff3c3c; animation: pulse 1.4s infinite; } .comp-summary.st-error { color: #ff3c3c; }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.comp-card { background: var(--panel); border-radius: 16px; padding: 18px 16px 14px; text-align: center; border: 2px solid transparent; display: grid; gap: 6px; justify-items: center; }
.comp-icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); }
.comp-icon svg { width: 44px; height: 44px; }
.comp-name { font-weight: 700; font-size: 14px; }
.comp-state { font-size: 13px; font-weight: 700; }
.comp-meta { display: grid; gap: 2px; font-size: 11px; color: var(--muted); }
.comp-card.st-ok { border-color: rgba(10,219,88,.45); } .comp-card.st-ok .comp-state { color: #0adb58; } .comp-card.st-ok .comp-icon { box-shadow: 0 0 0 4px rgba(10,219,88,.12); }
.comp-card.st-warn { border-color: rgba(255,180,60,.5); } .comp-card.st-warn .comp-state { color: #ffb43c; } .comp-card.st-warn .comp-icon { box-shadow: 0 0 0 4px rgba(255,180,60,.12); }
.comp-card.st-error { border-color: rgba(255,60,60,.6); } .comp-card.st-error .comp-state { color: #ff3c3c; } .comp-card.st-error .comp-icon { animation: pulse-ring 1.4s infinite; }
.comp-card.st-off .comp-state, .comp-card.st-nodata .comp-state { color: var(--muted); }
.comp-card.st-nodata { opacity: .7; }
.comp-legend i { border-radius: 50%; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(255,60,60,.5); } 70% { box-shadow: 0 0 0 12px rgba(255,60,60,0); } 100% { box-shadow: 0 0 0 0 rgba(255,60,60,0); } }
@media (prefers-reduced-motion: reduce) { .comp-card.st-error .comp-icon, .comp-summary.st-error .d { animation: none; } }

.gauge-st { font-size: 12px; font-weight: 700; margin-top: 4px; }

/* ---- Symulator ---- */
.sim-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.sim-sec { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.sim-sec h2 { margin: 0; }
.sim-sec input { width: 18px; height: 18px; accent-color: var(--green); }
.sim-inline { display: grid; grid-template-columns: 1fr 160px; align-items: center; gap: 8px; margin-bottom: 6px; }
.sim-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sim-chip { background: rgba(10,219,88,.15); border: 1px solid #0adb58; color: #fff; border-radius: 8px; padding: 4px 9px; cursor: pointer; font-weight: 700; display: grid; text-align: left; }
.sim-chip small { font-weight: 400; font-size: 10px; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim-chip:hover { background: rgba(255,60,60,.25); border-color: var(--red); }

.an-prev{margin-top:8px;max-height:300px;overflow:auto}
.an-prev table{width:100%}

/* przyciski zakładek automatu: równe kolumny, każdy wiersz na całą szerokość */
.tabs { --c: var(--c2, 7); }
.tabs a { flex: 1 1 calc((100% - (var(--c) - 1) * 6px) / var(--c)); min-width: 0; justify-content: center; text-align: center; line-height: 1.2; min-height: 34px; padding: 6px 6px; gap: 5px; font-size: 11.5px; }
.tabs a svg { flex: none; }
@media (max-width: 1350px) { .tabs { --c: var(--c3, 5); } }
@media (max-width: 900px) { .tabs { --c: 3; } }
@media (max-width: 560px) { .tabs { --c: 2; } }

/* Przeceny / happy hours */
.disc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: stretch; }
.disc-grid > .card { display: flex; flex-direction: column; }
.disc-grid > .card > .disc-actions { margin-top: auto; padding-top: 14px; }
@media (max-width: 1100px) { .disc-grid { grid-template-columns: 1fr; } }
.disc-range { display: grid; grid-template-columns: 34px 1fr 130px; gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.disc-no { width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #000; font-weight: 800; display: grid; place-items: center; margin-top: 24px; }
.pct-wrap { display: flex; align-items: center; gap: 6px; } .pct-wrap .input { text-align: right; } .pct-wrap span { font-weight: 700; }
.hh-row { display: grid; grid-template-columns: 1fr 1fr 130px; gap: 12px; margin-top: 10px; }
.day-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.day-chips label { cursor: pointer; } .day-chips input { display: none; }
.day-chips span { display: inline-block; min-width: 42px; text-align: center; padding: 7px 10px; border-radius: 8px; background: var(--panel-2); font-weight: 700; font-size: 12px; }
.day-chips input:checked + span { background: var(--green); color: #000; }
.disc-actions { margin-top: 14px; gap: 10px; flex-wrap: wrap; align-items: center; }
.err-text { color: #ff3c3c; }
td.num, th.num { text-align: right; }
.disc-actions > span.small:first-child { flex-basis: 100%; }

/* Publiczna strona automatu */
body.public { background: #000; }
.pub { min-height: 100vh; display: flex; flex-direction: column; }
.pub-head { display: flex; align-items: center; gap: 18px; padding: 14px 24px; border-bottom: 2px solid var(--green); flex-wrap: wrap; }
.pub-head .logo img { height: 46px; }
.pub-title h1 { margin: 0; font-size: 20px; }
.pub-head .langs { min-width: 160px; }
.pub-body { flex: 1; padding: 18px 24px; max-width: 1400px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.pub-intro { margin: 0 0 10px; }
.pub-stage { margin-top: 12px; overflow-x: auto; display: flex; }
.pub-stage .stage-row { margin: 0 auto; }
.pub-foot { padding: 14px 24px; text-align: center; } .pub-foot a { color: var(--green); }
.pub-pop { width: 290px; } .pub-form { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.pub-form .field { margin: 0; } .pub-pinrow { display: flex; flex-direction: column; gap: 8px; }
.pub-pin { letter-spacing: 6px; font-size: 18px; text-align: center; font-weight: 800; }
.pub-pop.sheet { position: fixed !important; left: 8px !important; right: 8px; bottom: 8px; top: auto !important; width: auto; max-height: 85vh; overflow: auto; }
.ok-text { color: #0adb58; }
.pub-link-row { display: flex; gap: 8px; } .pub-link-row .input { flex: 1; font-size: 13px; }
.pub-qr { margin: 14px 0 0; } .pub-qr svg { border-radius: 8px; }
@media (max-width: 640px) { .pub-head { padding: 10px 14px; } .pub-body { padding: 12px 14px; } .pub-head .logo img { height: 36px; } }
