/* HomeLab Control — komponenty. Kolory/odstępy wyłącznie z tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--fs); color: var(--text); line-height: 1.5;
  background: radial-gradient(900px 700px at -8% -12%, var(--bg-warm), transparent 62%),
              radial-gradient(1000px 760px at 108% 112%, var(--bg-cool), transparent 60%), var(--bg);
  background-attachment: fixed; min-height: 100vh; -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01", "tnum";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs); }
code, pre, .mono { font-family: var(--mono); font-size: 12px; }
pre { background: var(--field); border: 1px solid var(--glass-border); border-radius: var(--r-md); padding: 12px 14px;
      overflow: auto; max-height: 480px; white-space: pre-wrap; word-break: break-word; margin: 8px 0; }
hr { border: 0; border-top: 1px solid var(--glass-border); margin: 16px 0; }
::selection { background: rgba(var(--accent-rgb), .3); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.row { display: flex; gap: var(--gap-sm); align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--gap-sm); }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ───────── marka: rozstrzelony napis, jak w projekcie ───────── */
.wordmark { font-weight: 500; letter-spacing: .42em; font-size: 13px; color: var(--text-2); white-space: nowrap; text-transform: uppercase; }
.wordmark:hover { color: var(--text); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: var(--r-md); background: var(--accent-grad); display: grid; place-items: center;
              color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .04em; flex: none; }
.brand-name { font-weight: 600; white-space: nowrap; }
.brand-sub { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }

/* ───────── jedyne menu: pływający dok na dole ───────── */
.dock {
  position: fixed; left: var(--dock-gap); right: var(--dock-gap); bottom: var(--dock-gap); z-index: 45; margin: 0 auto; max-width: 1340px;
  height: var(--dock-h); display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; padding: 0 12px 0 28px;
  background: rgba(22, 22, 25, 0.86); border: 1px solid var(--glass-border-strong); border-radius: 40px;
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, .85);
}
.dock-brand { justify-self: start; }
.dock-nav { display: flex; gap: 6px; justify-content: center; min-width: 0; }
.dock-item { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 56px; padding: 0 2px; color: var(--text-3);
             font: inherit; font-size: 10px; background: none; border: 0; cursor: pointer; text-decoration: none; }
.dock-item:hover { color: var(--text-2); text-decoration: none; }
.dock-ic { position: relative; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--glass-strong);
           border: 1px solid var(--glass-border); color: var(--text-2); transition: background var(--t), color var(--t), border-color var(--t); }
.dock-ic svg { width: 18px; height: 18px; }
.dock-item:hover .dock-ic { background: var(--glass-hover); color: var(--text); }
.dock-item[aria-current="page"] { color: var(--text); }
.dock-item[aria-current="page"] .dock-ic { background: var(--glass-active); border-color: var(--glass-border-strong); color: var(--text); }
.dock-ic .badge { position: absolute; top: -5px; right: -7px; }
.dock-lbl { white-space: nowrap; }
.dock-ai-m { display: none; }
.dock-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.site-select select { width: auto; max-width: 180px; padding: 7px 28px 7px 12px; border-radius: var(--r-md); font-size: var(--fs-sm);
                      background-color: var(--glass-strong); border-color: var(--glass-border); color: var(--text); cursor: pointer; }
.site-switch { display: flex; gap: 2px; padding: 3px; background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: var(--r-md); flex-wrap: wrap; }
.site-switch button { border: 0; background: transparent; color: var(--text-3); padding: 6px 12px; border-radius: var(--r-sm); font: inherit;
                      font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; }
.site-switch button:hover { color: var(--text-2); }
.site-switch button[aria-pressed="true"] { background: var(--glass-active); color: var(--text); }
.live-pill { display: flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: var(--r-md); background: var(--glass-strong);
             border: 1px solid var(--glass-border); font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; }
.demo-tag { font-size: var(--fs-xs); padding: 3px 8px; border-radius: var(--r-pill); background: var(--warn-bg); color: var(--warn); white-space: nowrap; }
/* przycisk asystenta — w miejscu „Connect Wallet” */
.ai-btn { height: 44px; padding: 0 18px; border-radius: 12px; gap: 8px; position: relative; background: var(--accent-grad-rev); color: #fff; border: 0; }
.ai-btn:hover { filter: brightness(1.15); background: var(--accent-grad-rev); }
.ai-btn svg { width: 18px; height: 18px; }
.ai-btn.off { background: var(--glass-strong); color: var(--text-2); border: 1px solid var(--glass-border); }
.ai-fab-dot { position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--warn); border: 2px solid #161619; display: none; }
.ai-btn.unread .ai-fab-dot { display: block; }
.ai-btn.busy::after { content: ""; position: absolute; inset: -4px; border-radius: 15px; border: 1.5px solid transparent; border-top-color: var(--accent);
                      border-right-color: var(--rose); animation: fabspin 1.2s linear infinite; }
@keyframes fabspin { to { transform: rotate(360deg); } }
/* konto */
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; position: relative; }
.avatar-badge { position: absolute; top: -5px; right: -6px; background: var(--warn); color: #1a1200; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 600; color: #fff;
          background: radial-gradient(circle at 28% 22%, #c7a0a6, transparent 62%), radial-gradient(circle at 78% 82%, rgba(var(--accent-rgb), .9), transparent 66%), #2a2a30; }
.user-pop { position: absolute; right: 0; bottom: calc(100% + 14px); min-width: 220px; padding: 12px; display: flex; flex-direction: column; gap: 4px;
            background: #16161a; border: 1px solid var(--glass-border-strong); border-radius: var(--r-lg); box-shadow: 0 20px 40px -10px rgba(0,0,0,.8); z-index: 5; }
.user-pop a { color: var(--text); padding: 7px 8px; border-radius: var(--r-sm); font-size: var(--fs-sm); }
.user-pop a:hover { background: var(--glass-hover); text-decoration: none; }
.user-pop form { margin: 6px 0 0; }
/* telefon / wąskie okno: cienki pasek u góry z lokalizacją, stanem i kontem */
.topbar { display: none; }
.live-dot { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-md); background: var(--glass-strong); border: 1px solid var(--glass-border); }

main { padding: 28px 28px calc(var(--dock-h) + var(--dock-gap) + 36px); max-width: 1680px; margin: 0 auto; }

/* ───────── karty ───────── */
.card { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r-lg); padding: var(--pad); min-width: 0; position: relative; }
.card.tight { padding: 14px; border-radius: var(--r-md); }
/* nagłówek sekcji: mały szary tytuł, cienka linia, jaśniejszy odcinek pod tytułem */
.card-h, .section-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; padding-bottom: 11px;
                      border-bottom: 1px solid var(--glass-border); position: relative; }
.card-h h2, .card-h h3, .section-h h2 { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2);
                                        letter-spacing: .01em; position: relative; }
.card-h h2::after, .section-h h2::after { content: ""; position: absolute; left: 0; right: 0; bottom: -12px; height: 1px; background: var(--text-3); }
.card-h .sub { color: var(--text-3); font-size: var(--fs-xs); font-weight: 400; }
.section-h { margin-top: 6px; }
.card.bad { border-color: rgba(229, 87, 79, .45); }
.card.warn { border-color: rgba(224, 166, 74, .38); }
/* kolumna bez tła (jak „Events List” / „Online Chat”): tytuł z linią, pod spodem osobne wiersze */
.card.plain { background: none; border: 0; padding: 0; }

/* ───────── pulpit: bento ───────── */
.bento { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(0, 2.1fr) minmax(250px, 1fr); gap: 28px;
         grid-template-areas: "left center right" "map map map"; }
.bento > .b-left { grid-area: left; }
.bento > .b-center { grid-area: center; }
.bento > .b-right { grid-area: right; }
.bento > .map-panel { grid-area: map; }
.col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; min-height: 138px; cursor: pointer; transition: border-color var(--t), background var(--t); }
.tile:hover { border-color: var(--glass-border-strong); background: #151518; }
.tile .lbl { color: var(--text-2); font-size: var(--fs-sm); display: flex; align-items: center; gap: 10px; }
.tile .num { font-size: var(--fs-num); font-weight: 500; letter-spacing: -.02em; line-height: 1.1; }
.tile .num small { font-size: 14px; color: var(--text-3); font-weight: 400; margin-left: 4px; }
.tile .meta { color: var(--text-3); font-size: var(--fs-xs); margin-top: auto; }
.tile.wide { grid-column: span 2; }
/* karta „bohater” — rozmyty gradient jak karta salda w projekcie */
.tile.hero { background: radial-gradient(120% 140% at 0% 0%, rgba(var(--accent-rgb), .30), transparent 55%),
                         radial-gradient(120% 140% at 100% 100%, color-mix(in srgb, var(--rose) 45%, transparent), transparent 60%), #17171b;
             border-color: var(--glass-border-strong); }
.tile.hero.bad { background: radial-gradient(120% 140% at 0% 0%, rgba(229, 87, 79, .28), transparent 55%),
                             radial-gradient(120% 140% at 100% 100%, color-mix(in srgb, var(--rose) 40%, transparent), transparent 60%), #17171b; }
.num.ok { color: var(--ok); }
.num.warn { color: var(--warn); }
.num.bad { color: var(--bad); }
.icon-bubble { width: 32px; height: 32px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--glass-strong);
               border: 1px solid var(--glass-border); color: var(--text-2); flex: none; }
.icon-bubble svg { width: 16px; height: 16px; }
svg.ic { flex: none; color: var(--accent); vertical-align: middle; }
.empty svg.ic { display: block; margin: 0 auto 8px; width: 28px; height: 28px; }
.icon-bubble.bad { background: var(--bad-bg); color: var(--bad); border-color: rgba(229, 87, 79, .3); }
.icon-bubble.warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(224, 166, 74, .3); }
.bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent-grad); }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }
.split-bar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; gap: 2px; }
.split-bar i { display: block; height: 100%; }

/* listy / oś czasu */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 1px; background: linear-gradient(var(--glass-border-strong), transparent); }
.timeline li { position: relative; padding: 0 0 14px 26px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 5px; width: 9px; height: 9px; border-radius: 50%;
                       background: var(--bg); border: 2px solid var(--accent); }
.timeline li.warning::before { border-color: var(--warn); }
.timeline li.critical::before { border-color: var(--bad); background: var(--bad); }
.timeline .t { font-size: var(--fs-xs); color: var(--text-3); }
.timeline .ttl { font-size: var(--fs-sm); color: var(--text); }
.timeline .who { font-size: var(--fs-xs); color: var(--accent); }
/* w kolumnie bez tła każdy wpis to osobny ciemny wiersz z paskiem stanu po lewej (jak lista wydarzeń w projekcie) */
.plain .timeline::before { display: none; }
.plain .timeline li { padding: 10px 12px 10px 16px; margin-bottom: 8px; background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--r-md); overflow: hidden; }
.plain .timeline li::before { left: 0; top: 0; bottom: 0; width: 3px; height: auto; border: 0; border-radius: 0; background: var(--accent); }
.plain .timeline li.warning::before { background: var(--warn); }
.plain .timeline li.critical::before { background: var(--bad); }
.feed { max-height: 760px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2a2a2e transparent; }
.feed-item { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); transition: background var(--t); }
.plain .feed-item { background: var(--glass); border: 1px solid var(--glass-border); margin-bottom: 8px; }
.feed-item:hover { background: var(--glass-hover); }
.feed-item.fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { border-color: rgba(var(--accent-rgb), .6); } to { border-color: var(--glass-border); } }
.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--glass-border); }
.list-row:last-child { border-bottom: 0; }

/* kropki i znaczniki stanu */
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--unknown); display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); animation: pulse 1.6s infinite; }
.dot.none { background: transparent; border: 1.5px dashed var(--text-3); }
@keyframes pulse { 50% { opacity: .45; } }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: var(--r-sm); font-size: var(--fs-xs);
        font-weight: 500; background: var(--glass-strong); color: var(--text-2); border: 1px solid var(--glass-border); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: rgba(var(--accent-rgb), .25); }
.pill.live { background: rgba(123, 216, 143, .12); color: var(--live); border-color: rgba(123, 216, 143, .3); }
.pill.warn, .pill.warning { background: var(--warn-bg); color: var(--warn); border-color: rgba(224, 166, 74, .3); }
.pill.bad, .pill.critical { background: var(--bad-bg); color: var(--bad); border-color: rgba(229, 87, 79, .35); }
.pill.info { background: rgba(142, 156, 240, .12); color: var(--info); border-color: rgba(142, 156, 240, .3); }
.pill.unknown { background: var(--unknown-bg); color: var(--text-2); }
.pill.none { color: var(--text-3); }
.badge { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 600;
         display: inline-grid; place-items: center; }
.badge.warn { background: var(--warn); color: #1a1200; }

/* ───────── przyciski i formularze ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 15px; border-radius: var(--r-md); font: inherit;
       font-size: var(--fs-sm); font-weight: 500; cursor: pointer; border: 1px solid var(--glass-border-strong); background: var(--glass-strong);
       color: var(--text); transition: background var(--t), filter var(--t), border-color var(--t); white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--glass-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
/* główny: gradient turkus → róż, jak „SWAP” */
.btn.primary { background: var(--accent-grad); color: #fff; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.12); }
.btn.danger { background: var(--bad-bg); color: var(--bad); border-color: rgba(229, 87, 79, .35); }
.btn.danger:hover { background: rgba(229, 87, 79, .2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--glass-hover); }
.btn.big { padding: 13px 18px; font-size: var(--fs); width: 100%; white-space: normal; }
.btn.warn-btn { background: var(--warn-bg); color: var(--warn); border-color: rgba(224, 166, 74, .35); }
.btn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.action-tile { display: flex; flex-direction: column; gap: 6px; }
.btn.sm { padding: 5px 10px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn.icon { padding: 7px; width: 34px; height: 34px; }
.btn svg { width: 15px; height: 15px; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); min-width: 0; }
input, select, textarea { font: inherit; font-size: var(--fs); color: var(--text); background: var(--field); border: 1px solid var(--glass-border-strong);
       border-radius: var(--r-md); padding: 9px 12px; width: 100%; min-width: 0; transition: border-color var(--t), box-shadow var(--t); }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(var(--accent-rgb), .7); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .12); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); flex: none; }
.stack > .btn { align-self: flex-start; }
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
select option { background: var(--bg-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; }

/* tabele */
.tbl-wrap { overflow-x: auto; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad); }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tbl th { text-align: left; color: var(--text-3); font-weight: 500; font-size: var(--fs-xs); letter-spacing: .02em;
          padding: 8px 10px; border-bottom: 1px solid var(--glass-border); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--glass-border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: rgba(255,255,255,.015); }

/* zakładki: podkreślenie jak „Liquid Pool / Trade Pool” */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--glass-border); margin-bottom: 22px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 0; background: transparent; color: var(--text-3); padding: 10px 16px; font: inherit; font-size: var(--fs-sm);
               cursor: pointer; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--t); }
.tabs button:hover { color: var(--text-2); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }
.tabs button .badge { margin-left: 6px; }

/* ───────── mapa ───────── */
.map-wrap { position: relative; height: 560px; border-radius: var(--r-md); overflow: hidden; background:
  radial-gradient(circle at 1px 1px, rgba(255,255,255,.05) 1px, transparent 0) 0 0 / 24px 24px, var(--bg-2);
  border: 1px solid var(--glass-border); touch-action: none; user-select: none; }
/* zablokowany zoom: palec przewija stronę zamiast przesuwać/skalować mapę */
.zoom-locked .map { touch-action: pan-x pan-y; }
.map-wrap.full { height: calc(100vh - var(--dock-h) - 230px); min-height: 460px; }
.map-wrap svg.map { width: 100%; height: 100%; display: block; cursor: grab; }
.map-wrap svg.map.panning { cursor: grabbing; }
.map-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; z-index: 2; flex-wrap: wrap; justify-content: flex-end; }
.map-legend { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 12px; font-size: var(--fs-xs); color: var(--text-2);
              background: rgba(14,14,16,.88); padding: 6px 10px; border-radius: var(--r-md); border: 1px solid var(--glass-border); }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.node-box { fill: #141417; stroke: #2c2c32; stroke-width: 1; }
.node.sel .node-box { stroke: var(--accent); stroke-width: 2; }
.node.ok .node-box { stroke: rgba(var(--accent-rgb), .4); }
.node.warn .node-box { stroke: var(--warn); stroke-width: 1.5; }
.node.bad .node-box { stroke: var(--bad); stroke-width: 1.8; fill: #1b1415; }
.node .name { fill: var(--text); font-size: 13px; font-weight: 600; }
.node .sub { fill: var(--text-3); font-size: 11px; font-family: var(--mono); }
.node .reason { fill: var(--bad); font-size: 10.5px; }
.node.warn .reason { fill: var(--warn); }
.node .kid-box { fill: #1a1a1e; stroke: #29292e; }
.node .kid.ok .kid-box { stroke: rgba(var(--accent-rgb), .3); }
.node .kid.warn .kid-box { stroke: var(--warn); fill: rgba(224,166,74,.07); }
.node .kid.bad .kid-box { stroke: var(--bad); fill: rgba(229,87,79,.1); }
.node .kid text { fill: var(--text-2); font-size: 11px; }
.node .icon { color: var(--text-2); }
.node.bad .icon { color: var(--bad); }
.node.warn .icon { color: var(--warn); }
.edge { fill: none; stroke: rgba(var(--accent-rgb), .4); stroke-width: 1.4; }
.edge.soft { stroke-dasharray: 5 5; stroke: rgba(161,161,168,.4); }
.edge.hot { stroke: var(--bad); stroke-width: 2.2; }
.cable { stroke: rgba(255,255,255,.13); stroke-width: 1.2; fill: none; }
.node.drop-ok .node-box { stroke: var(--live); stroke-width: 2.5; }
.handle { fill: var(--accent); cursor: crosshair; opacity: 0; transition: opacity var(--t); }
.node:hover .handle, .editing .handle { opacity: .9; }
.map-side { position: absolute; top: 12px; left: 12px; width: min(340px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; z-index: 3; }

/* ───────── szuflady i modale ───────── */
.drawer { position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(520px, calc(100vw - 24px)); z-index: 60; display: flex; flex-direction: column;
          background: #111113; border: 1px solid var(--glass-border-strong); border-radius: 18px; box-shadow: -30px 0 60px -20px rgba(0,0,0,.8);
          transform: translateX(calc(100% + 24px)); transition: transform 220ms cubic-bezier(.2,.8,.2,1); }
.drawer.open { transform: none; }
.drawer.drop { box-shadow: inset 0 0 0 2px var(--accent), -30px 0 60px -20px rgba(0,0,0,.8); }
.proposal.changes { border-style: solid; border-color: rgba(var(--accent-rgb), .35); }
.drawer-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--glass-border); }
.drawer-h h2 { font-size: var(--fs); }
.drawer-b { flex: 1; overflow-y: auto; padding: 16px 18px; }
.drawer-f { padding: 12px 18px 18px; border-top: 1px solid var(--glass-border); }
.drawer-f textarea { background: #1a1a1d; border-color: var(--glass-border); }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 55; }
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.6); }
.modal > .card { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: #131316; border-color: var(--glass-border-strong); }
.toasts { position: fixed; bottom: calc(var(--dock-h) + var(--dock-gap) + 14px); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 10px 16px; border-radius: var(--r-md); background: #1a1a1e; border: 1px solid var(--glass-border-strong); font-size: var(--fs-sm);
         box-shadow: 0 10px 30px rgba(0,0,0,.6); max-width: min(560px, calc(100vw - 32px)); }
.toast.err { border-color: rgba(229,87,79,.5); color: #ffd6d2; }

/* czat AI — wiersze jak w „Online Chat” */
.chat-msg { margin: 0 0 12px; }
.chat-msg .bubble { padding: 11px 13px; border-radius: var(--r-md); background: var(--glass-strong); border: 1px solid var(--glass-border); overflow-wrap: anywhere; font-size: var(--fs-sm); }
.chat-msg.user .bubble { background: #1f1c1e; border-color: color-mix(in srgb, var(--rose) 30%, transparent); margin-left: 40px; }
.chat-msg .bubble > :first-child { margin-top: 0; }
.chat-msg .bubble > :last-child { margin-bottom: 0; }
.chat-tools { font-size: var(--fs-xs); color: var(--text-3); margin: 0 0 10px 4px; }
.proposal { border: 1px dashed rgba(var(--accent-rgb), .45); border-radius: var(--r-md); padding: 10px 12px; margin-top: 8px; background: rgba(var(--accent-rgb), .04); }
.proposal.risky { border-color: rgba(229, 87, 79, .55); background: rgba(229, 87, 79, .05); }
pre.cmd { margin: 6px 0; background: #0b0b0d; border-color: var(--glass-border); color: #d9e7e6; max-height: 360px; }
pre.cmd.out { color: var(--text-2); }
.chg { margin-top: 4px; }
.chg summary { cursor: pointer; color: var(--warn); }
.chg > div { margin: 4px 0 0 14px; }
.shell-h { border-bottom: 1px solid var(--glass-border); padding: 8px 0; }
.shell-h summary { cursor: pointer; display: flex; align-items: center; gap: 8px; }
.stor { margin-bottom: 12px; }
.stor .bar { margin-top: 6px; }
.pve-tbl td .btn + .btn { margin-left: 4px; }
.md h1, .md h2, .md h3 { margin: 14px 0 6px; font-size: var(--fs-lg); }
.md h3 { font-size: var(--fs); }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 20px; }
.md table { border-collapse: collapse; font-size: var(--fs-sm); margin: 8px 0; display: block; overflow-x: auto; }
.md td, .md th { border: 1px solid var(--glass-border); padding: 5px 8px; }
.md code { background: rgba(255,255,255,.07); padding: 1px 5px; border-radius: 5px; }
.md pre code { background: none; padding: 0; }

/* wykres */
.chart { width: 100%; height: 180px; display: block; }
.chart .grid { stroke: rgba(255,255,255,.05); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.chart .area { fill: url(#chartGrad); }
.chart .fc { stroke: var(--warn); stroke-dasharray: 5 4; stroke-width: 1.5; fill: none; }
.chart text { fill: var(--text-3); font-size: 10px; }
.chart .thr { stroke: var(--bad); stroke-dasharray: 3 4; opacity: .6; }
.spark { width: 100%; height: 40px; }

/* wybór sposobu monitorowania */
.mon-opts { display: grid; gap: 8px; }
.mon-opt { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--glass-border); cursor: pointer; background: var(--glass-strong); }
.mon-opt input { width: auto; margin-top: 3px; }
.mon-opt > span { display: flex; flex-direction: column; gap: 2px; }
.mon-opt.on { border-color: rgba(var(--accent-rgb), .5); background: var(--accent-soft); }

/* lista urządzeń */
.dev-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: var(--gap); }
.dev-toolbar input[type=search] { width: 240px; }
.dev-toolbar select { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: var(--r-md); border: 1px solid var(--glass-border);
        background: var(--glass-strong); color: var(--text-2); font: inherit; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; }
.chip b { color: var(--text); font-weight: 600; }
.chip[aria-pressed="true"] { border-color: var(--glass-border-strong); background: var(--glass-active); color: var(--text); }
.banner-row { display: flex; align-items: center; gap: 14px; border-color: rgba(var(--accent-rgb), .3); }
.bulk-bar { position: sticky; top: 8px; z-index: 5; margin-bottom: var(--gap); border-color: rgba(var(--accent-rgb), .4); flex-wrap: wrap; gap: 8px; }
.bulk-bar select { width: auto; }
.dev-table { padding: 6px 0; }
.dev-row { display: grid; grid-template-columns: minmax(220px, 2.2fr) minmax(110px, .9fr) minmax(110px, .9fr) minmax(120px, 1.1fr) minmax(170px, 1.1fr) minmax(100px, .8fr);
           gap: 12px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--glass-border); }
body[data-role="admin"] .dev-row { grid-template-columns: 22px minmax(220px, 2.2fr) minmax(110px, .9fr) minmax(110px, .9fr) minmax(120px, 1.1fr) minmax(170px, 1.1fr) minmax(100px, .8fr); }
.dev-row.head { border-top: 0; font-size: var(--fs-xs); color: var(--text-3); letter-spacing: .02em; padding-top: 8px; padding-bottom: 8px; }
.dev-row:not(.head):hover { background: var(--glass-hover); }
.dev-row.st-bad { background: linear-gradient(90deg, var(--bad-bg), transparent 40%); box-shadow: inset 3px 0 0 var(--bad); }
.dev-row.st-warn { background: linear-gradient(90deg, var(--warn-bg), transparent 40%); box-shadow: inset 3px 0 0 var(--warn); }
.dev-row.st-none { opacity: .6; }
.dev-row > span { min-width: 0; }
.dev-row .c-name { display: flex; align-items: flex-start; gap: 10px; }
.dev-row .c-name .dot { margin-top: 6px; }
.dev-row .c-name a { color: var(--text); }
.dev-row .reason { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-row .c-mon { display: flex; flex-direction: column; gap: 2px; }
.dev-row .mon-sel { padding: 5px 8px; font-size: var(--fs-sm); width: 100%; }
.dev-row input[type=checkbox] { width: auto; }
@media (max-width: 1060px) {
  .dev-row, body[data-role="admin"] .dev-row { grid-template-columns: 22px minmax(0, 1fr) auto; grid-template-areas: "sel name last" "sel kind ip" "sel where mon"; row-gap: 4px; }
  body:not([data-role="admin"]) .dev-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name last" "kind ip" "where mon"; }
  .dev-row.head { display: none; }
  .c-sel { grid-area: sel; align-self: start; padding-top: 3px; } .c-name { grid-area: name; } .c-last { grid-area: last; text-align: right; }
  .c-kind { grid-area: kind; padding-left: 18px; } .c-ip { grid-area: ip; text-align: right; } .c-where { grid-area: where; padding-left: 18px; }
  .c-mon { grid-area: mon; } .dev-row .mon-sel { width: auto; max-width: 180px; }
}

/* wybór koloru */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.swatch { width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--glass-border-strong); background: var(--sw); cursor: pointer; padding: 0;
          position: relative; overflow: hidden; }
.swatch[aria-pressed="true"] { border-color: var(--text); outline: 2px solid var(--sw); outline-offset: 2px; }
.swatch.custom { background: conic-gradient(#e5574f, #e0a64a, #7bd88f, #5fb8b4, #8e9cf0, #b98c92, #e5574f); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; padding: 0; border: 0; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(400px, 100%); }

/* układy stron */
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-h p { margin: 4px 0 0; color: var(--text-3); font-size: var(--fs-sm); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.dev-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--gap); align-items: start; }
/* karta urządzenia */
#dSub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.dsub-reason { max-width: min(560px, 100%); display: inline-block; vertical-align: bottom; }
.dev-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: var(--gap); }
.tile.sm { min-height: 0; gap: 4px; }
.tile.sm .num { font-size: 22px; }
.tile.static { cursor: default; }
.tile.static:hover { border-color: var(--glass-border); background: var(--glass); }
.num.unknown, .num.none { color: var(--text-3); }
.meter { display: flex; align-items: center; gap: 10px; min-width: 0; }
.meter .bar { width: 110px; flex: none; }
.meter > span { min-width: 0; }
.hint-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-style: dashed; }
.pre-line { white-space: pre-line; }
.timeline.compact li { padding-bottom: 10px; }
.subnav { margin-bottom: var(--gap); }
.row-actions { text-align: right; }
/* aktualizacja na żywo */
.card.live { border-color: rgba(var(--accent-rgb), .45); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--text-3); padding: 5px 12px 5px 5px;
            border: 1px solid var(--glass-border); border-radius: 99px; }
.steps .n { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; background: rgba(255,255,255,.06); }
.steps li.done { color: var(--text-2); }
.steps li.done .n { background: var(--ok); color: #0b0b0c; }
.steps li.cur { color: var(--text); border-color: rgba(var(--accent-rgb), .5); }
.steps li.cur .n { background: var(--accent); color: #0b0b0c; animation: pulse 1.4s infinite; }
.steps li.fail { color: var(--bad); border-color: var(--bad); }
.steps li.fail .n { background: var(--bad); color: #0b0b0c; }
.spin { display: inline-block; width: 11px; height: 11px; border: 2px solid rgba(var(--accent-rgb), .3); border-top-color: var(--accent);
        border-radius: 50%; animation: fabspin .8s linear infinite; vertical-align: -1px; }
.upd-log { margin-top: 10px; max-height: 180px; overflow: auto; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: var(--fs-sm); margin: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.empty { color: var(--text-3); text-align: center; padding: 28px 12px; font-size: var(--fs-sm); }
.diff .add { color: #9fdcaa; } .diff .del { color: #f0a9a3; } .diff .hunk { color: var(--accent); }

/* ───────── responsywność ───────── */
@media (max-width: 1480px) {
  .live-pill .txt, .demo-tag { display: none; }
  .dock-item { min-width: 50px; }
  .site-select select { max-width: 150px; }
}
@media (max-width: 1320px) {
  .dock { grid-template-columns: auto minmax(0, 1fr) auto; padding-left: 22px; }
  .dock-brand { letter-spacing: .28em; font-size: 12px; }
  .ai-btn .txt { display: none; }
  .ai-btn { padding: 0 13px; }
  .bento { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "center center" "left right" "map map"; }
}
/* węższe okno: lokalizacja, stan i konto przechodzą do paska u góry; dok zostaje menu */
@media (max-width: 1100px) {
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px 0; max-width: 1680px; margin: 0 auto; }
  .topbar .user-pop { bottom: auto; top: calc(100% + 10px); }
  .dock-right .site-select, .dock-right .live-pill, .dock-right .user-menu, .dock-right .demo-tag { display: none; }
  .dock-brand { display: none; }
  .dock { grid-template-columns: minmax(0, 1fr) auto; padding-left: 12px; }
  .dock-nav { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .dock-nav::-webkit-scrollbar { display: none; }
  .dev-layout { grid-template-columns: 1fr; }
  .dev-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding-top: 16px; }
}
@media (max-width: 760px) {
  :root { --dock-h: 66px; --dock-gap: 8px; }
  main { padding: 14px 16px calc(var(--dock-h) + var(--dock-gap) + 26px); }
  .topbar { padding: 10px 16px 0; }
  .dock { padding: 0 8px; border-radius: 22px; grid-template-columns: minmax(0, 1fr); }
  .dock-right { display: none; }
  .dock-ai-m { display: flex; }
  .dock-item.m-hide { display: none; }
  .dock-nav { justify-content: space-around; }
  .topbar .row { flex-wrap: nowrap; }
  .topbar .wordmark { letter-spacing: .3em; font-size: 12px; }
  .topbar .site-select select { max-width: 130px; }
  .dock-item { min-width: 50px; font-size: 9.5px; }
  .dock-ic { width: 36px; height: 36px; border-radius: 11px; }
  .site-select select { max-width: 150px; }
  .bento { grid-template-columns: 1fr; grid-template-areas: "center" "map" "right" "left"; gap: 20px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile.wide { grid-column: span 2; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .map-wrap { height: 420px; }
  .kv { grid-template-columns: 110px 1fr; }
  .meter .bar { width: 64px; }
  .hint-card { flex-direction: column; align-items: flex-start; }
  .page-h { align-items: flex-start; }
  .dev-toolbar input[type=search] { width: 100%; }
  .dev-toolbar > .row { width: 100%; flex-wrap: wrap; }
  .dev-row, body[data-role="admin"] .dev-row { padding: 12px 14px; }
  .banner-row { flex-wrap: wrap; }
  .drawer { top: 0; right: 0; bottom: 0; width: 100vw; border-radius: 0; }
}
