:root{
  --bg:#0b1020;
  --panel:#101a33;
  --panel2:#0f172a;
  --text:#e5e7eb;
  --muted:#94a3b8;
  --border:rgba(148,163,184,.18);
  --primary:#7c3aed;
  --primary2:#a78bfa;
  --danger:#ef4444;
  --good:#22c55e;
  --shadow:0 14px 40px rgba(0,0,0,.35);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 800px at 15% 10%, rgba(124,58,237,.30), transparent 60%),
              radial-gradient(900px 600px at 90% 0%, rgba(34,197,94,.14), transparent 55%),
              var(--bg);
  color:var(--text);
}

.hidden{ display:none !important; }

.topbar{
  position:sticky;
  top:0;
  z-index:50;
  padding:10px 14px;
  backdrop-filter: blur(10px);
  background: rgba(16,26,51,.55);
  border-bottom:1px solid var(--border);
}
.topbar-inner{ display:flex; align-items:center; gap:10px; }
.badge{
  padding:6px 10px;
  border-radius:999px;
  font-weight:700;
  background: rgba(34,197,94,.16);
  border:1px solid rgba(34,197,94,.30);
  color:#d1fae5;
}
.topbar-text{ color:var(--muted); font-size:13px; }

.layout{ display:flex; min-height:calc(100vh - 0px); }

.sidebar{
  width:280px;
  padding:18px 14px;
  border-left:1px solid var(--border);
  background: linear-gradient(180deg, rgba(16,26,51,.85), rgba(15,23,42,.65));
  box-shadow: var(--shadow);
}

.brand{
  font-size:16px;
  font-weight:800;
  letter-spacing:.3px;
  display:flex;
  align-items:center;
  gap:10px;
}
.logo-dot{ width:10px; height:10px; border-radius:999px; background: var(--primary); box-shadow:0 0 0 6px rgba(124,58,237,.18); }
.brand-sub{ color:var(--muted); font-size:12px; margin-top:6px; }

.sidebar-toggle{
  display:none;
  margin-top:14px;
  width:100%;
}

nav{ margin-top:14px; display:flex; flex-direction:column; gap:8px; }

button, input, textarea, select{
  font: inherit;
}

.tab-link{
  text-align:right;
  background: rgba(148,163,184,.06);
  border:1px solid var(--border);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  transition: .15s ease;
}
.tab-link:hover{ transform: translateY(-1px); border-color: rgba(167,139,250,.45); }
.tab-link.active{ background: rgba(124,58,237,.18); border-color: rgba(167,139,250,.55); }

.main{
  flex:1;
  padding:22px 22px 60px;
}

.header{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  margin-bottom:14px;
}

.title{
  margin:0;
  font-size:22px;
  letter-spacing:.2px;
}
.subtitle{ margin:6px 0 0; color:var(--muted); font-size:13px; }

.card{
  background: rgba(16,26,51,.70);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
  box-shadow: var(--shadow);
}

.tab{ display:none; }
.tab.active{ display:block; }

label{ display:block; margin-top:12px; margin-bottom:6px; color:var(--muted); font-size:12px; }
input, textarea, select{
  width:100%;
  background: rgba(2,6,23,.55);
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 12px;
  color:var(--text);
  outline:none;
}
textarea{ resize:vertical; min-height:110px; }
input:focus, textarea:focus, select:focus{ border-color: rgba(167,139,250,.55); box-shadow:0 0 0 4px rgba(124,58,237,.15); }

.row{ display:flex; flex-wrap:wrap; align-items:center; gap:12px; }
.row > *{ flex:1; min-width:220px; }
.row .fit{ flex:0 0 auto; min-width:auto; }

.primary, .secondary, .danger{
  width:auto;
  border-radius:12px;
  padding:10px 14px;
  border:1px solid var(--border);
  cursor:pointer;
}
.primary{ background: linear-gradient(135deg, rgba(124,58,237,.95), rgba(167,139,250,.90)); color:#0b1020; font-weight:800; }
.secondary{ background: rgba(148,163,184,.08); color:var(--text); }
.danger{ background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.35); color:#fecaca; }
.primary:hover, .secondary:hover, .danger:hover{ transform: translateY(-1px); }

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  font-size:12px;
  color:var(--muted);
  background: rgba(148,163,184,.06);
}
.pill.good{ color:#d1fae5; border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.12); }

.hint{ color:var(--muted); font-size:12px; }

.log{
  margin-top:12px;
  background: rgba(2,6,23,.55);
  border:1px dashed rgba(148,163,184,.25);
  border-radius:12px;
  padding:12px;
  color:#cbd5e1;
  overflow:auto;
  max-height:240px;
}

.download-link{
  display:inline-flex;
  margin-top:12px;
  padding:10px 12px;
  border-radius:12px;
  background: rgba(34,197,94,.12);
  border:1px solid rgba(34,197,94,.25);
  color:#d1fae5;
  text-decoration:none;
}

table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  margin-top:12px;
  overflow:hidden;
  border-radius:14px;
  border:1px solid var(--border);
}
thead th{
  background: rgba(148,163,184,.08);
  color: var(--muted);
  font-size:12px;
  text-align:right;
  padding:10px;
  border-bottom:1px solid var(--border);
}
tbody td{
  padding:10px;
  border-bottom:1px solid rgba(148,163,184,.10);
  vertical-align:middle;
}
tbody tr:hover td{ background: rgba(124,58,237,.06); }

.action-btn{
  padding:8px 10px;
  border-radius:10px;
  background: rgba(148,163,184,.08);
  border:1px solid var(--border);
  color:var(--text);
  cursor:pointer;
}
.action-btn:hover{ border-color: rgba(167,139,250,.45); }
.action-btn.danger{ background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.35); color:#fecaca; }

.modal{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:100;
}
.modal-card{
  width:min(860px, 100%);
  background: rgba(16,26,51,.90);
  border:1px solid var(--border);
  border-radius:18px;
  padding:16px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 32px);
  overflow:auto;
  -webkit-overflow-scrolling: touch;
}
.modal-header{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.modal-title{ font-weight:900; }
.modal-sub{ color:var(--muted); font-size:12px; margin-top:4px; }

.caps-list{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:10px;
  margin-top:12px;
}
.cap-item{
  display:flex;
  gap:10px;
  padding:10px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(2,6,23,.45);
}
.cap-name{ font-weight:800; }
.cap-desc{ color:var(--muted); font-size:12px; margin-top:4px; }

.subgrid{ display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:12px; }
.subcard{ border:1px solid var(--border); border-radius:16px; padding:12px; background: rgba(2,6,23,.35); }
.subcard h3{ margin:0 0 8px; }

@media (max-width: 980px){
  .sidebar{ width:260px; }
}

@media (max-width: 860px){
  .layout{ flex-direction:column; }
  .sidebar{ width:100%; border-left:none; border-bottom:1px solid var(--border); }
  .sidebar-toggle{ display:block; }
  nav{ display:none; }
  .caps-list{ grid-template-columns: 1fr; }
  .subgrid{ grid-template-columns: 1fr; }
  .row > *{ min-width: 160px; }
  .table-wrap{ overflow-x:auto; -webkit-overflow-scrolling: touch; }
}


/* Mobile cards (Bundles/others) */
.cards-wrap{ display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:10px; margin-top:12px; }
.card-item{ border:1px solid var(--border); border-radius:16px; padding:12px; background: rgba(2,6,23,.35); }
.card-item .k{ color:var(--muted); font-size:12px; margin-top:6px; }
.card-item .v{ font-weight:800; }
.card-actions{ display:flex; gap:10px; margin-top:10px; }
.card-actions button{ flex:1; }
@media (max-width: 840px){
  .cards-wrap{ grid-template-columns: 1fr; }
  #tab-bundles .table-wrap{ display:none; }
  #bundlesCards{ display:grid !important; }
}

/* V24 visible checkboxes + mobile cards */
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  border: 2px solid rgba(255,255,255,0.55);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  vertical-align: middle;
  transition: all .18s ease;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.18) inset;
}
input[type="checkbox"]:checked { background: linear-gradient(135deg, #7c3aed, #a855f7); border-color: #d8b4fe; }
input[type="checkbox"]:checked::after { content: "✓"; color:#fff; font-size:15px; font-weight:700; }
.bundle-card, .device-card, .cert-card { position: relative; }
.bundle-card input[type="checkbox"], .device-card input[type="checkbox"], .cert-card input[type="checkbox"] {
  position:absolute; top:14px; right:14px; z-index:5;
}
html[dir="ltr"] .bundle-card input[type="checkbox"], html[dir="ltr"] .device-card input[type="checkbox"], html[dir="ltr"] .cert-card input[type="checkbox"] {
  right:auto; left:14px;
}
@media (max-width:768px) {
  input[type="checkbox"] { width:26px; height:26px; min-width:26px; min-height:26px; }
}
