:root{
  --bg:#070911;
  --sidebar:#0b0e1a;
  --card:#101423;
  --card2:#151a2d;
  --surface:#0c101d;
  --border:#1f2640;
  --border-hi:#2f395e;
  --text:#eef2fb;
  --muted:#8792ad;
  --accent:#7c6cff;
  --accent-hi:#9c90ff;
  --accent2:#4cc9f0;
  --ok:#2ecc71;
  --warn:#f5b942;
  --bad:#ff4d64;
  --radius:18px;
  --sb-w:246px;
}
*{box-sizing:border-box;margin:0;padding:0}
html{-webkit-text-size-adjust:100%}
body{
  font-family:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  background:
    radial-gradient(920px 520px at 18% -8%, rgba(124,108,255,.16) 0%, transparent 62%),
    radial-gradient(760px 460px at 92% 4%, rgba(76,201,240,.10) 0%, transparent 58%),
    var(--bg);
  color:var(--text);min-height:100vh;line-height:1.45;
  overflow-x:hidden;
}
[hidden]{display:none !important}

/* ==================== APP SHELL (BAL OLDALSÁV + MUNKATERÜLET) ==================== */
.app-shell{
  display:flex;min-height:100vh;width:100%;
}
.sidebar-backdrop{
  position:fixed;inset:0;background:rgba(4,6,12,.72);z-index:80;
  -webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);
}
.sidebar{
  width:var(--sb-w);flex:none;
  background:linear-gradient(180deg,#0d1120 0%,#090c16 100%);
  border-right:1px solid var(--border);
  display:flex;flex-direction:column;justify-content:space-between;
  padding:20px 14px 16px;
  position:sticky;top:0;height:100vh;overflow-y:auto;z-index:90;
}
.sb-top{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:2px 6px 20px}
.sb-close{
  display:none;border:1px solid var(--border);background:var(--surface);color:var(--muted);
  width:32px;height:32px;border-radius:10px;cursor:pointer;font-size:.95rem;
}

.brand{display:flex;align-items:center;gap:11px;font-weight:800;letter-spacing:.05em;font-size:1.1rem}
.brand-icon{
  width:36px;height:36px;border-radius:11px;flex:none;
  display:inline-flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,rgba(124,108,255,.28),rgba(76,201,240,.14));
  border:1px solid rgba(124,108,255,.48);
  color:var(--accent-hi);
  box-shadow:0 0 22px rgba(124,108,255,.28);
}
.brand-icon svg{width:19px;height:19px}
.brand-text{display:flex;flex-direction:column;min-width:0}
.brand-text span{line-height:1.15;color:var(--text)}
.brand-text small{color:var(--muted);font-weight:500;letter-spacing:.02em;font-size:.7rem;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.nav{display:flex;flex-direction:column;gap:4px;flex:1}
.nav-btn{
  font:inherit;font-size:.86rem;font-weight:600;cursor:pointer;color:var(--muted);
  padding:10px 12px;border-radius:12px;border:1px solid transparent;background:transparent;
  transition:all .18s ease;display:flex;align-items:center;gap:11px;width:100%;text-align:left;
}
.nav-ic{width:18px;height:18px;flex:none;opacity:.75;transition:color .18s,opacity .18s}
.nav-btn:hover{color:var(--text);background:rgba(255,255,255,.04)}
.nav-btn:hover .nav-ic{opacity:1}
.nav-btn.active{
  color:#fff;
  background:linear-gradient(90deg,rgba(124,108,255,.22),rgba(124,108,255,.08));
  border-color:rgba(124,108,255,.42);
  box-shadow:0 4px 18px rgba(124,108,255,.16);
}
.nav-btn.active .nav-ic{color:var(--accent-hi);opacity:1}
.badge{
  margin-left:auto;background:var(--bad);color:#fff;font-size:.68rem;font-weight:800;
  padding:1px 7px;border-radius:999px;line-height:1.4;
}

.sb-foot{
  margin-top:14px;padding-top:14px;border-top:1px solid var(--border);
  display:flex;flex-direction:column;gap:10px;
}
.sb-profile{display:flex;align-items:center;gap:10px;padding:4px 4px}
.sb-avatar{
  width:36px;height:36px;border-radius:50%;flex:none;
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  color:#fff;font-weight:800;font-size:.9rem;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 0 16px rgba(124,108,255,.35);
}
.sb-user-meta{min-width:0;flex:1}
.sb-user-name{font-size:.86rem;font-weight:700;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sb-user-role{font-size:.72rem;color:var(--muted)}
.sb-logout{width:100%}

/* ==================== MUNKATERÜLET & FELSŐ SÁV ==================== */
.workspace{
  flex:1;min-width:0;padding:22px 26px 32px;
  max-width:1460px;margin:0 auto;
}
.topbar{
  display:flex;align-items:flex-start;justify-content:space-between;gap:14px;flex-wrap:wrap;
  margin-bottom:20px;
}
.top-left{display:flex;align-items:flex-start;gap:12px}
.mobile-menu-btn{
  display:none;align-items:center;justify-content:center;
  width:40px;height:40px;border-radius:12px;border:1px solid var(--border);
  background:var(--card);color:var(--text);cursor:pointer;flex:none;margin-top:2px;
}
.greet-sub{font-size:.86rem;color:var(--muted);font-weight:500}
.greet-title{
  font-size:1.55rem;font-weight:800;letter-spacing:-.02em;line-height:1.2;
  display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:1px;
}
.greet-meta{font-size:.78rem;color:var(--muted);margin-top:4px}

.tools{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.top-status-box{display:flex;flex-direction:column;align-items:flex-end;gap:4px}
.top-sub-note{font-size:.71rem;color:var(--muted)}

.api{
  display:flex;align-items:center;gap:8px;font-size:.78rem;font-weight:600;color:var(--muted);
  padding:7px 14px;border:1px solid var(--border);border-radius:999px;background:var(--card);
}
.dot{width:8px;height:8px;border-radius:50%;background:var(--muted)}
.api.on .dot{background:var(--ok);box-shadow:0 0 10px var(--ok)}
.api.on{color:#c9f6da;border-color:rgba(46,204,113,.35)}
.api.off .dot{background:var(--bad);box-shadow:0 0 10px var(--bad)}
.api.off{color:var(--bad);border-color:rgba(255,77,100,.45)}

/* Mobil oldalsáv (<960px) */
@media(max-width:959px){
  .sidebar{
    position:fixed;left:0;top:0;bottom:0;transform:translateX(-105%);
    transition:transform .24s ease;box-shadow:12px 0 40px rgba(0,0,0,.65);
  }
  .sidebar.open{transform:translateX(0)}
  .sb-close{display:inline-flex;align-items:center;justify-content:center}
  .mobile-menu-btn{display:inline-flex}
  .workspace{padding:16px 14px 28px}
  .greet-title{font-size:1.28rem}
  .top-status-box{align-items:flex-start}
}

/* ==================== GOMBOK & KÁRTYÁK ==================== */
.btn{
  font:inherit;font-size:.8rem;font-weight:600;cursor:pointer;color:var(--text);
  padding:8px 15px;border-radius:11px;border:1px solid var(--border);background:var(--surface);
  transition:border-color .18s,color .18s,background .18s,box-shadow .18s,transform .1s;
  text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:6px;
}
.btn:hover{border-color:var(--accent);color:var(--accent-hi);background:rgba(124,108,255,.08)}
.btn.active{
  border-color:rgba(124,108,255,.65);color:#fff;
  background:linear-gradient(135deg,var(--accent),#6252f0);
  box-shadow:0 4px 16px rgba(124,108,255,.32);
}
.btn.active:hover{filter:brightness(1.08);color:#fff}
.btn.ok{border-color:rgba(46,204,113,.45);color:var(--ok);background:rgba(46,204,113,.1)}
.btn.ok:hover{background:rgba(46,204,113,.2)}
.btn.warn{border-color:rgba(245,185,66,.45);color:var(--warn);background:rgba(245,185,66,.1)}
.btn.danger{border-color:rgba(255,77,100,.42);color:var(--bad);background:rgba(255,77,100,.09)}
.btn.danger:hover{background:rgba(255,77,100,.2)}
.btn.sm{padding:5px 11px;font-size:.74rem;border-radius:9px}
.btn:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

.card{
  background:linear-gradient(180deg,var(--card2) 0%,var(--card) 100%);
  border:1px solid var(--border);border-radius:var(--radius);padding:18px 20px;
  box-shadow:0 10px 30px rgba(0,0,0,.38);min-width:0;
}
.card h2{
  display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;
  font-size:.82rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;
  color:var(--muted);margin-bottom:14px;
}

/* ==================== NOVARA DASHBOARD BENTO LAYOUT ==================== */
.dash-layout{
  display:grid;gap:18px;grid-template-columns:1fr;align-items:start;
}
@media(min-width:1080px){
  .dash-layout{grid-template-columns:minmax(0,1.55fr) minmax(320px,1fr)}
}
.dash-main,.dash-side{display:flex;flex-direction:column;gap:18px;min-width:0}
.dash-layout.stale .val,.dash-layout.stale .gauge-val{opacity:.45}

/* Hero Banner Card */
.hero-card{
  position:relative;overflow:hidden;padding:24px;
  background:
    radial-gradient(520px 260px at 85% 20%, rgba(124,108,255,.32), transparent 65%),
    radial-gradient(400px 240px at 14% 92%, rgba(76,201,240,.16), transparent 65%),
    linear-gradient(135deg,#171c36 0%,#0f1324 55%,#0b0e1b 100%);
  border-color:rgba(124,108,255,.3);
}
.hero-glow{
  position:absolute;right:-40px;top:-40px;width:220px;height:220px;border-radius:50%;
  background:radial-gradient(circle,rgba(124,108,255,.28),transparent 70%);
  pointer-events:none;
}
.hero-top{display:flex;align-items:center;justify-content:space-between;gap:10px;position:relative}
.hero-badge{
  font-size:.72rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;
  color:var(--accent-hi);background:rgba(124,108,255,.15);
  border:1px solid rgba(124,108,255,.35);padding:4px 11px;border-radius:999px;
}
.hero-mid{margin:20px 0 18px;position:relative}
.hero-title{font-size:1.75rem;font-weight:800;letter-spacing:-.02em;color:#fff;margin-bottom:4px}
.hero-desc{font-size:.84rem;color:#aeb8d4;max-width:520px}
.hero-chips{display:flex;flex-wrap:wrap;gap:9px;position:relative}
.hero-chip{
  display:inline-flex;align-items:center;gap:8px;padding:7px 13px;border-radius:12px;
  background:rgba(8,11,22,.68);border:1px solid rgba(255,255,255,.09);
  -webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);
  font-size:.78rem;color:var(--muted);
}
.hero-chip b{color:#fff;font-weight:700;font-variant-numeric:tabular-nums}

/* Novara Devices Overview Table */
.devices-card h2{text-transform:none;letter-spacing:0;font-size:1rem;color:var(--text)}
.dev-table-hdr{
  display:grid;grid-template-columns:1.8fr 1fr .9fr auto;gap:10px;
  padding:0 10px 10px;border-bottom:1px solid var(--border);
  font-size:.72rem;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;
}
.dev-table-body{display:flex;flex-direction:column}
.dev-row{
  display:grid;grid-template-columns:1.8fr 1fr .9fr auto;gap:10px;align-items:center;
  padding:11px 10px;border-bottom:1px solid rgba(31,38,64,.65);
  transition:background .15s;border-radius:10px;
}
.dev-row:hover{background:rgba(124,108,255,.05)}
.dev-row:last-child{border-bottom:0}
.dev-cell-main{display:flex;align-items:center;gap:11px;min-width:0}
.dev-ic{
  width:36px;height:36px;border-radius:11px;flex:none;
  background:var(--surface);border:1px solid var(--border);
  display:flex;align-items:center;justify-content:center;font-size:1.05rem;
}
.dev-row.on .dev-ic{
  border-color:rgba(124,108,255,.45);
  background:rgba(124,108,255,.14);
  box-shadow:0 0 14px rgba(124,108,255,.22);
}
.dev-name-wrap{min-width:0}
.dev-name{font-size:.88rem;font-weight:700;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dev-room{font-size:.72rem;color:var(--muted)}
.dev-status{display:inline-flex;align-items:center;gap:6px;font-size:.8rem;font-weight:600;color:var(--muted)}
.dev-status i{width:7px;height:7px;border-radius:50%;background:#596482;display:inline-block}
.dev-status.on{color:var(--ok)}
.dev-status.on i{background:var(--ok);box-shadow:0 0 8px var(--ok)}
.dev-type{font-size:.78rem;color:var(--muted)}
@media(max-width:600px){
  .dev-table-hdr{display:none}
  .dev-row{grid-template-columns:1fr auto;gap:8px}
  .dev-status,.dev-type{display:none}
}

/* Novara Circular Gauge Card */
.gauge-wrap{position:relative;width:196px;height:126px;margin:4px auto 8px}
.gauge-svg{width:100%;height:100%;overflow:visible}
.gauge-track{
  fill:none;stroke:#1a2138;stroke-width:11;stroke-linecap:round;
}
.gauge-fill{
  fill:none;stroke:url(#gaugeGrad);stroke-width:11;stroke-linecap:round;
  stroke-dasharray:265;stroke-dashoffset:265;
  transition:stroke-dashoffset .7s ease;
  filter:drop-shadow(0 0 8px rgba(124,108,255,.48));
}
.gauge-center{
  position:absolute;inset:28px 0 0;display:flex;flex-direction:column;align-items:center;justify-content:center;
}
.gauge-val{font-size:1.75rem;font-weight:800;color:#fff;line-height:1.1;font-variant-numeric:tabular-nums}
.gauge-lbl{font-size:.76rem;color:var(--muted);margin-top:3px}
.gauge-lbl b{color:var(--accent2)}
.gauge-tiles{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:12px}
.g-tile{
  background:var(--surface);border:1px solid var(--border);border-radius:12px;
  padding:9px 11px;display:flex;flex-direction:column;gap:2px;
}
.g-tile span{font-size:.69rem;color:var(--muted)}
.g-tile b{font-size:.82rem;color:var(--text);font-variant-numeric:tabular-nums}
.sys-bars{border-top:1px solid rgba(31,38,64,.65);padding-top:8px}

.ai-quick-card{
  background:
    radial-gradient(280px 140px at 90% 0%, rgba(124,108,255,.2), transparent 70%),
    linear-gradient(180deg,var(--card2),var(--card));
}

/* ==================== OLDAL RÁCSOK ==================== */
.page{width:100%}
.two-col{display:grid;gap:16px;grid-template-columns:1fr}
@media(min-width:860px){.two-col{grid-template-columns:1fr 1fr}}
.two-col.single-col{grid-template-columns:1fr}
.admin-grid{display:grid;gap:16px;grid-template-columns:1fr}
@media(min-width:920px){.admin-grid{grid-template-columns:1.1fr 1fr}.admin-wide{grid-column:1/-1}}

/* ==================== PILLS, SOROK, SÁVOK ==================== */
.pill{
  font-size:.7rem;font-weight:700;letter-spacing:.03em;text-transform:none;
  padding:3px 10px;border-radius:999px;border:1px solid transparent;white-space:nowrap;
}
.pill.ok{color:var(--ok);background:rgba(46,204,113,.13);border-color:rgba(46,204,113,.35)}
.pill.warn{color:var(--warn);background:rgba(245,185,66,.13);border-color:rgba(245,185,66,.35)}
.pill.bad{color:var(--bad);background:rgba(255,77,100,.13);border-color:rgba(255,77,100,.35)}
.pill.idle{color:var(--muted);background:rgba(135,146,173,.1);border-color:var(--border)}

.row{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid rgba(31,38,64,.65)}
.row:last-child{border-bottom:0}
.row>span:first-child{color:var(--muted);font-size:.86rem}
.val{font-size:1rem;font-weight:700;font-variant-numeric:tabular-nums;transition:opacity .3s;text-align:right}
.val.sm{font-size:.86rem}
.bar{height:7px;border-radius:99px;background:var(--surface);border:1px solid var(--border);overflow:hidden;margin:8px 0 4px}
.bar b{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--accent),var(--accent2));border-radius:99px;transition:width .5s,background .3s}
.note{font-size:.8rem;color:var(--muted);margin-top:4px}
.sub{font-size:.7rem;color:var(--muted);text-transform:uppercase;letter-spacing:.1em;margin:14px 0 6px;font-weight:700}
h2 + .sub{margin-top:0}

/* Novara Glowing Violet Switch */
.sw{
  position:relative;width:46px;height:25px;border-radius:99px;border:1px solid var(--border-hi);
  background:#151b30;cursor:pointer;flex:none;
  transition:background .22s,border-color .22s,box-shadow .22s,opacity .2s;
}
.sw::after{
  content:"";position:absolute;top:2px;left:2px;width:19px;height:19px;border-radius:50%;
  background:#8f9ab8;transition:transform .22s,background .22s;
}
.sw[aria-checked="true"]{
  background:linear-gradient(90deg,#6c5ce7,var(--accent-hi));
  border-color:var(--accent-hi);
  box-shadow:0 0 14px rgba(124,108,255,.55);
}
.sw[aria-checked="true"]::after{transform:translateX(21px);background:#fff}
.sw[data-busy]{opacity:.5;cursor:wait}

/* Terminál */
.term{
  background:#060810;border:1px solid var(--border);border-radius:12px;padding:11px 13px;
  font:12px/1.65 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  height:185px;overflow-y:auto;color:#9deec0;word-break:break-word;
}
.term.tall{height:240px}
.term .t,.term .empty{color:var(--muted)}

/* Űrlapok és listák */
.stack{display:flex;flex-direction:column;gap:10px}
.field{
  width:100%;font:inherit;font-size:.85rem;color:var(--text);padding:9px 12px;border-radius:11px;
  background:var(--surface);border:1px solid var(--border);outline:none;transition:border-color .2s,box-shadow .2s;
}
.field:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(124,108,255,.16)}
.field::placeholder{color:#5e6a87}
.sm-field{width:175px;padding:6px 10px;font-size:.82rem}

.dropzone{
  border:2px dashed var(--border-hi);border-radius:14px;padding:28px 16px;text-align:center;
  background:rgba(12,16,29,.7);cursor:pointer;transition:border-color .2s,background .2s;margin-bottom:14px;
}
.dropzone:hover,.dropzone.drag{border-color:var(--accent);background:rgba(124,108,255,.09)}
.drop-title{font-weight:700;font-size:.95rem}
.toolbar{display:flex;gap:8px;margin-bottom:12px;flex-wrap:wrap}

.secret-box{
  margin-top:14px;padding:14px;border-radius:12px;background:rgba(124,108,255,.1);
  border:1px solid rgba(124,108,255,.42);display:flex;flex-direction:column;gap:8px;
}
.secret-title{font-weight:700;color:var(--accent-hi);font-size:.9rem}
.secret-box code{
  display:block;padding:8px 10px;border-radius:8px;background:#060810;border:1px solid var(--border);
  font-size:.78rem;word-break:break-all;color:#9deec0;
}

/* ==================== ADMIN & CSOPORTOSÍTOTT JOGOSULTSÁGFA ==================== */
.admin-form{display:grid;gap:8px;margin-top:16px;padding-top:16px;border-top:1px solid var(--border)}
@media(min-width:680px){.admin-form{grid-template-columns:1fr 1fr auto auto}}
.u-row{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:12px 0;border-bottom:1px solid rgba(31,38,64,.65);flex-wrap:wrap}
.u-row:last-child{border-bottom:0}
.u-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.u-name{font-weight:700;font-size:.95rem}
.u-acts{display:flex;gap:6px;flex-wrap:wrap}
.u-perms{display:flex;flex-wrap:wrap;gap:6px;width:100%;margin-top:7px}
.chip{
  font-size:.71rem;color:#c2cce3;background:var(--surface);border:1px solid var(--border);
  border-radius:999px;padding:3px 10px;display:inline-flex;align-items:center;gap:4px;
}
.chip.cam{color:#d3ccff;background:rgba(124,108,255,.13);border-color:rgba(124,108,255,.35)}
.chip.smart{color:#aef0c8;background:rgba(46,204,113,.11);border-color:rgba(46,204,113,.32)}
.chip.mod{color:#b6e6f9;background:rgba(76,201,240,.1);border-color:rgba(76,201,240,.3)}

.perm-edit{
  width:100%;margin-top:10px;padding:14px;border-radius:14px;
  background:#0a0d18;border:1px solid rgba(124,108,255,.35);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}
.perm-edit-top{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:12px}
.perm-edit-top select{width:auto;min-width:150px}

.perm-tree-wrap{width:100%;margin-top:6px}
.perm-tree{display:flex;flex-direction:column;gap:12px}
.perm-group{
  background:var(--card);border:1px solid var(--border);border-radius:13px;overflow:hidden;
}
.perm-group-hdr{
  display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;
  padding:10px 14px;background:rgba(255,255,255,.025);border-bottom:1px solid var(--border);
}
.perm-group-title{display:flex;align-items:center;gap:8px;font-size:.82rem;font-weight:700;color:var(--text)}
.perm-group-acts{display:flex;gap:6px}
.perm-group-body{padding:10px 14px;display:flex;flex-direction:column;gap:8px}

/* Kamera soronkénti jogok */
.perm-cam-row{
  display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;
  padding:8px 11px;border-radius:10px;background:var(--surface);border:1px solid var(--border);
}
.perm-cam-name{display:flex;align-items:center;gap:7px;font-size:.84rem;font-weight:600;color:var(--text)}
.perm-cam-loc{font-size:.74rem;color:var(--muted);font-weight:400}
.perm-cam-flags{display:flex;flex-wrap:wrap;gap:6px}

/* Okosotthon eszközök rácsa */
.perm-dev-grid{display:grid;gap:8px;grid-template-columns:repeat(auto-fill,minmax(195px,1fr))}
.perm-chk{
  display:inline-flex;align-items:center;gap:7px;font-size:.77rem;color:var(--text);
  background:var(--surface);border:1px solid var(--border);border-radius:10px;
  padding:6px 11px;cursor:pointer;user-select:none;transition:border-color .15s,background .15s;
}
.perm-chk input{accent-color:var(--accent);cursor:pointer;width:14px;height:14px;flex:none}
.perm-chk:has(input:checked){
  border-color:rgba(124,108,255,.6);
  background:rgba(124,108,255,.15);
  color:#fff;
}
.perm-chk.smart-item{width:100%;justify-content:flex-start;padding:8px 11px}
.perm-chk.smart-item:has(input:checked){
  border-color:rgba(46,204,113,.55);
  background:rgba(46,204,113,.12);
}
.perm-chk.disabled{opacity:.55;cursor:default}
.perm-dev-meta{display:flex;flex-direction:column;min-width:0}
.perm-dev-meta b{font-size:.8rem;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.perm-dev-meta small{font-size:.69rem;color:var(--muted)}
.perm-mod-grid{display:flex;flex-wrap:wrap;gap:7px}

.stat-bar{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin-bottom:12px}
@media(min-width:640px){.stat-bar{grid-template-columns:repeat(4,1fr)}}
.stat-box{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:12px;text-align:center}
.stat-box b{display:block;font-size:1.25rem;font-variant-numeric:tabular-nums;color:var(--accent-hi)}
.stat-box span{font-size:.72rem;color:var(--muted)}
.card-foot{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.no-perms{text-align:center;color:var(--muted);padding:32px 18px}

/* ==================== KAMERÁK PANEL ==================== */
.cam-form{display:grid;gap:8px;grid-template-columns:1fr}
@media(min-width:760px){.cam-form{grid-template-columns:1fr 1fr 1.2fr}.cam-url{grid-column:1/3}}
.cam-grid{display:grid;gap:16px;grid-template-columns:1fr}
@media(min-width:860px){.cam-grid{grid-template-columns:repeat(2,1fr)}}
.cam-grid .no-perms{grid-column:1/-1}
.cam-view{
  position:relative;width:100%;aspect-ratio:16/9;background:#060810;border:1px solid var(--border);
  border-radius:12px;overflow:hidden;display:flex;align-items:center;justify-content:center;margin:10px 0;
}
.cam-view img,.cam-view iframe{width:100%;height:100%;object-fit:cover;border:0;display:block}
.cam-fallback{padding:16px;text-align:center;color:var(--muted);font-size:.82rem;display:flex;flex-direction:column;gap:8px;align-items:center}
.cam-fallback code{background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:6px 10px;font-size:.75rem;color:#9deec0;word-break:break-all;max-width:100%}
.ptz-panel{
  margin-top:10px;padding:12px;border-radius:12px;background:var(--surface);border:1px solid var(--border);
  display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;
}
.ptz-pad{display:grid;grid-template-columns:repeat(3,40px);gap:5px}
.ptz-btn{
  width:40px;height:36px;border-radius:10px;border:1px solid var(--border);background:var(--card);
  color:var(--text);font-size:.95rem;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;
  transition:border-color .15s,background .15s,color .15s;
}
.ptz-btn:hover{border-color:var(--accent);color:var(--accent-hi);background:rgba(124,108,255,.15)}
.ptz-btn:active{transform:scale(.95)}
.ptz-side{flex:1;min-width:170px;display:flex;flex-direction:column;gap:8px}
.ptz-row{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.ptz-presets{display:flex;gap:5px;flex-wrap:wrap}
.ptz-cfg{margin-top:10px;padding:12px;border-radius:12px;background:var(--surface);border:1px solid var(--border);display:grid;gap:8px;grid-template-columns:1fr 1fr}
@media(max-width:640px){.ptz-cfg{grid-template-columns:1fr}}

/* ==================== TOAST & LOGIN OVERLAY ==================== */
.toast{
  position:fixed;left:50%;bottom:22px;transform:translate(-50%,20px);z-index:200;
  padding:10px 18px;border-radius:999px;font-size:.85rem;opacity:0;pointer-events:none;
  background:rgba(18,22,40,.95);border:1px solid rgba(124,108,255,.4);color:var(--text);
  -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
  box-shadow:0 10px 28px rgba(0,0,0,.45);
  transition:opacity .25s,transform .25s;max-width:calc(100vw - 32px);
}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast.bad{border-color:rgba(255,77,100,.55);color:var(--bad)}

.overlay{
  position:fixed;inset:0;z-index:100;display:flex;align-items:center;justify-content:center;padding:20px;
  background:rgba(4,6,13,.68);
  -webkit-backdrop-filter:blur(18px) saturate(140%);
  backdrop-filter:blur(18px) saturate(140%);
}
.glass{
  position:relative;width:100%;max-width:390px;padding:30px 26px 24px;border-radius:24px;
  background:linear-gradient(155deg,rgba(25,31,56,.92),rgba(12,15,28,.95));
  border:1px solid rgba(124,108,255,.28);
  box-shadow:0 24px 64px rgba(0,0,0,.62),inset 0 1px 0 rgba(255,255,255,.1);
  text-align:center;
}
.glass::before{
  content:"";position:absolute;inset:-1px;border-radius:inherit;pointer-events:none;z-index:-1;
  background:radial-gradient(280px 140px at 50% 0%,rgba(124,108,255,.32),transparent 70%);
}
.glass p{color:var(--muted);font-size:.84rem;margin-bottom:16px}
.glass input{
  width:100%;font:inherit;color:var(--text);padding:11px 14px;border-radius:12px;
  background:rgba(7,10,20,.72);border:1px solid var(--border-hi);outline:none;
  transition:border-color .2s,box-shadow .2s;
}
.glass input + input{margin-top:10px}
.glass input::placeholder{color:#62708a}
.glass input:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(124,108,255,.22)}
.glass button[type=submit]{
  width:100%;margin-top:14px;font:inherit;font-weight:700;letter-spacing:.03em;cursor:pointer;
  padding:12px;border-radius:12px;border:1px solid rgba(124,108,255,.65);color:#fff;
  background:linear-gradient(135deg,var(--accent-hi),var(--accent));
  box-shadow:0 8px 24px rgba(124,108,255,.35);transition:transform .1s,filter .2s,opacity .2s;
}
.glass button[type=submit]:hover{transform:translateY(-1px);filter:brightness(1.06)}
.glass button[type=submit]:disabled{opacity:.55;cursor:wait;transform:none}
.err{
  margin-top:12px;font-size:.82rem;color:var(--bad);background:rgba(255,77,100,.1);
  border:1px solid rgba(255,77,100,.32);border-radius:10px;padding:9px 11px;
}
.err.ok{color:var(--ok);background:rgba(46,204,113,.1);border-color:rgba(46,204,113,.35)}
.hwid-foot{
  margin-top:14px;padding-top:12px;border-top:1px solid rgba(255,255,255,.09);
  display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:.74rem;color:var(--muted);
}
.hwid-foot code{color:var(--accent2);font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.76rem}
.hwid-add{display:grid;gap:6px;margin-top:8px;grid-template-columns:1fr 1fr auto}
@media(max-width:640px){.hwid-add{grid-template-columns:1fr}}

/* ==================== LÁMPA VEZÉRLŐ ==================== */
.light-panel{
  width:100%;margin-top:10px;padding:12px 13px;border-radius:14px;
  background:var(--surface);border:1px solid rgba(124,108,255,.32);
  display:flex;flex-direction:column;gap:10px;
}
.light-row{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:.82rem;color:var(--muted)}
.light-row b{color:var(--text);font-variant-numeric:tabular-nums}
.light-slider{
  width:100%;height:7px;border-radius:99px;outline:none;cursor:pointer;
  -webkit-appearance:none;appearance:none;background:#1c2540;
}
.light-slider.bri{background:linear-gradient(90deg,#1c2540,#ffd86b)}
.light-slider.ct{background:linear-gradient(90deg,#ffae52,#fff3d6,#a8d8ff)}
.light-slider::-webkit-slider-thumb{
  -webkit-appearance:none;appearance:none;width:18px;height:18px;border-radius:50%;
  background:#fff;border:2px solid var(--accent);box-shadow:0 2px 8px rgba(0,0,0,.45);cursor:pointer;
}
.swatches{display:flex;flex-wrap:wrap;gap:7px;align-items:center}
.swatch{
  width:24px;height:24px;border-radius:50%;border:2px solid rgba(255,255,255,.22);
  cursor:pointer;padding:0;transition:transform .12s,border-color .15s;
}
.swatch:hover{transform:scale(1.14);border-color:#fff}
.swatch-picker{
  width:28px;height:26px;padding:0;border:1px solid var(--border);border-radius:8px;
  background:transparent;cursor:pointer;
}
.scene-bar{display:flex;flex-wrap:wrap;gap:6px}

/* ==================== TERMUX FALLBACK & OFFLINE MODULOK ==================== */
.api.warn .dot{background:var(--warn);box-shadow:0 0 10px var(--warn)}
.api.warn{color:var(--warn);border-color:rgba(245,185,66,.45)}
.fallback-banner{
  margin-bottom:18px;padding:12px 16px;border-radius:14px;
  background:rgba(245,185,66,.1);border:1px solid rgba(245,185,66,.38);color:var(--text);
  display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;font-size:.84rem;
}
.nav-btn.nav-offline{opacity:.6}
.nav-btn.nav-offline::after{
  content:"";width:7px;height:7px;border-radius:50%;background:var(--bad);display:inline-block;margin-left:auto;
}
.card.card-offline{opacity:.62;border-style:dashed;border-color:rgba(245,185,66,.35)}
.offline-view-card{text-align:center;padding:38px 22px;max-width:560px;margin:24px auto}
.offline-view-card h3{font-size:1.15rem;margin-bottom:8px;color:var(--text)}

/* ==================== BRP AI PANEL ==================== */
.ai-top-bar{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.ai-top-bar select{flex:1;min-width:200px}
.ai-chat-log{
  min-height:240px;max-height:460px;overflow-y:auto;padding:14px;margin-bottom:12px;
  border-radius:14px;background:#080b15;border:1px solid var(--border);
  display:flex;flex-direction:column;gap:10px;
}
.ai-msg{
  max-width:86%;padding:10px 14px;border-radius:14px;font-size:.9rem;line-height:1.5;
  white-space:pre-wrap;word-break:break-word;
}
.ai-msg.user{
  align-self:flex-end;background:rgba(124,108,255,.18);border:1px solid rgba(124,108,255,.45);color:#fff;
}
.ai-msg.assistant{
  align-self:flex-start;background:#13182a;border:1px solid var(--border);color:var(--text);
}
.ai-msg.err{
  align-self:flex-start;background:rgba(255,77,100,.12);border:1px solid rgba(255,77,100,.38);color:var(--bad);
}
.ai-msg-meta{font-size:.7rem;color:var(--muted);margin-bottom:4px;font-weight:700;letter-spacing:.04em}
.ai-chat-form{display:flex;gap:8px;align-items:center}
.ai-chat-form input{flex:1}
.ai-nodes-bar{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
@media(min-width:780px){.ai-node-form{grid-template-columns:1.1fr 1.5fr 95px 1fr auto}}

/* ==================== ÉRTESÍTÉSEK (HARANG + FIÓK) ==================== */
.notif-wrap{position:relative}
.notif-bell-btn{
  position:relative;width:40px;height:40px;border-radius:12px;border:1px solid var(--border);
  background:var(--card);color:var(--text);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;
  transition:border-color .18s,background .18s;
}
.notif-bell-btn:hover{border-color:var(--accent);background:rgba(124,108,255,.12);color:var(--accent-hi)}
.notif-badge{
  position:absolute;top:-5px;right:-5px;min-width:19px;height:19px;padding:0 5px;border-radius:999px;
  background:var(--bad);color:#fff;font-size:.66rem;font-weight:800;line-height:19px;text-align:center;
  box-shadow:0 0 10px rgba(255,77,100,.6);
}
.notif-drawer{
  position:absolute;right:0;top:48px;width:min(360px,calc(100vw - 28px));z-index:120;
  background:linear-gradient(180deg,var(--card2),var(--card));border:1px solid var(--border-hi);
  border-radius:16px;box-shadow:0 18px 46px rgba(0,0,0,.62);overflow:hidden;
}
.notif-hdr{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  padding:11px 14px;border-bottom:1px solid var(--border);font-size:.86rem;
}
.notif-list{max-height:360px;overflow-y:auto;padding:10px;display:flex;flex-direction:column;gap:8px}
.notif-item{
  padding:10px 12px;border-radius:12px;background:var(--surface);border:1px solid var(--border);
  display:flex;flex-direction:column;gap:4px;
}
.notif-item.unread{border-color:rgba(124,108,255,.55);background:rgba(124,108,255,.09)}
.notif-item.bad{border-color:rgba(255,77,100,.48)}
.notif-item.warn{border-color:rgba(245,185,66,.45)}
.notif-item-top{display:flex;align-items:center;justify-content:space-between;gap:8px}
.notif-item-title{font-size:.82rem;font-weight:700;color:var(--text)}
.notif-item-time{font-size:.68rem;color:var(--muted)}
.notif-item-msg{font-size:.76rem;color:#c2cce3;white-space:pre-line;line-height:1.4}
