:root{
  --bg0:#070A12;
  --bg1:#0B1022;
  --card:rgba(255,255,255,.06);
  --card2:rgba(255,255,255,.09);
  --stroke:rgba(255,255,255,.12);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.64);
  --muted2:rgba(255,255,255,.48);
  --shadow: 0 20px 60px rgba(0,0,0,.55);
  --shadow2: 0 10px 30px rgba(0,0,0,.35);
  --radius: 18px;
  --radius2: 14px;
  --accent:#7C5CFF;
  --accent2:#28D9FF;
  --good:#31D07A;
  --warn:#FFB020;
  --danger:#FF4D6D;
  --focus: 0 0 0 3px rgba(124,92,255,.35);
  color-scheme: dark;
}

[data-theme="light"]{
  --bg0:#F6F7FB;
  --bg1:#FFFFFF;
  --card:rgba(10,20,40,.05);
  --card2:rgba(10,20,40,.08);
  --stroke:rgba(10,20,40,.12);
  --text:rgba(10,20,40,.92);
  --muted:rgba(10,20,40,.68);
  --muted2:rgba(10,20,40,.55);
  --shadow: 0 20px 60px rgba(10,20,40,.12);
  --shadow2: 0 10px 30px rgba(10,20,40,.10);
  --accent:#5B4BFF;
  --accent2:#0077FF;
  color-scheme: light;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(124,92,255,.45), transparent 55%),
    radial-gradient(1000px 700px at 85% 0%, rgba(40,217,255,.30), transparent 60%),
    radial-gradient(900px 600px at 50% 110%, rgba(49,208,122,.18), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  color:var(--text);
}

a{color:inherit; text-decoration:none}
button, input{font:inherit}

.shell{
  min-height:100%;
  display:grid;
  grid-template-columns: 280px 1fr;
}

.sidebar{
  position:sticky;
  top:0;
  height:100vh;
  padding:18px;
  border-right:1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
  backdrop-filter: blur(14px);
}

.brand{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 14px 12px;
  border-radius: var(--radius);
  background: var(--card);
  border:1px solid var(--stroke);
  box-shadow: var(--shadow2);
}

.brand h1{
  margin:0;
  font-size:14px;
  letter-spacing:.4px;
  font-weight:650;
}

.brand small{display:block; margin-top:3px; color:var(--muted); font-weight:520}

.pill{
  font-size:12px;
  color:var(--muted);
  border:1px solid var(--stroke);
  padding:6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.03);
  white-space:nowrap;
}

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

.nav a{
  padding:10px 12px;
  border-radius: 12px;
  border:1px solid transparent;
  color:var(--muted);
  background: transparent;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.nav a:hover{
  border-color: var(--stroke);
  background: rgba(255,255,255,.04);
  color: var(--text);
}

.nav .k{
  font-size:12px;
  color:var(--muted2);
  border:1px solid var(--stroke);
  padding:2px 8px;
  border-radius: 999px;
}

.main{
  padding:24px 22px 70px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom:18px;
}

.search{
  flex:1;
  max-width: 720px;
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 14px;
  border-radius: 14px;
  background: var(--card);
  border:1px solid var(--stroke);
  box-shadow: var(--shadow2);
}
.search input{
  width:100%;
  border:0;
  outline:0;
  background: transparent;
  color: var(--text);
}
.search input::placeholder{color:var(--muted2)}

.actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.btn{
  padding:10px 12px;
  border-radius: 12px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
}
.btn:hover{background: rgba(255,255,255,.07)}
.btn:focus{outline:none; box-shadow: var(--focus)}
.btn.primary{
  border-color: rgba(124,92,255,.55);
  background: linear-gradient(135deg, rgba(124,92,255,.32), rgba(40,217,255,.14));
}

.hero{
  border-radius: var(--radius);
  border:1px solid var(--stroke);
  background: linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  box-shadow: var(--shadow);
  overflow:hidden;
}
.hero-inner{
  padding:20px 20px 18px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}
.hero h2{
  margin:0;
  font-size:22px;
  letter-spacing:-.2px;
}
.hero p{
  margin:10px 0 0;
  color:var(--muted);
  max-width: 62ch;
  line-height: 1.35;
}

.kpis{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:12px;
  padding:14px;
  border-top: 1px solid var(--stroke);
  background: rgba(0,0,0,.08);
}
[data-theme="light"] .kpis{background: rgba(255,255,255,.45)}

.kpi{
  padding:12px 12px 10px;
  border-radius: 14px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.04);
}
.kpi .label{font-size:12px; color:var(--muted2)}
.kpi .value{margin-top:6px; font-size:18px; font-weight:700}
.kpi .sub{margin-top:4px; font-size:12px; color:var(--muted)}

.section{
  margin-top:18px;
}
.section h3{
  margin:0 0 10px;
  font-size:14px;
  color: var(--muted);
  letter-spacing:.3px;
  font-weight:650;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
}

.card{
  border:1px solid var(--stroke);
  border-radius: var(--radius2);
  background: var(--card);
  box-shadow: var(--shadow2);
  padding:14px 14px 14px;
  position:relative;
  min-height: 112px;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.badge{
  position:absolute;
  top:12px;
  left:12px;
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius: 999px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  font-size:12px;
  color: var(--muted);
}
.badge .dot{
  width:10px;
  height:10px;
  border-radius: 999px;
  display:inline-block;
  background: rgba(255,255,255,.35);
  box-shadow: 0 0 0 3px rgba(255,255,255,.07);
}
.badge.online .dot{background: rgba(49,208,122,.95); box-shadow: 0 0 0 3px rgba(49,208,122,.18)}
.badge.offline .dot{background: rgba(255,77,109,.95); box-shadow: 0 0 0 3px rgba(255,77,109,.18)}
.badge.online{border-color: rgba(49,208,122,.35); color: rgba(49,208,122,.95)}
.badge.offline{border-color: rgba(255,77,109,.38); color: rgba(255,77,109,.95)}

.card.has-badge .title{margin-top:28px}
.card:hover{
  transform: translateY(-2px);
  background: var(--card2);
  border-color: rgba(124,92,255,.35);
}
.card:focus-within{box-shadow: var(--shadow2), var(--focus)}

.card .title{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}
.card .title strong{font-weight:720}
.card .desc{color:var(--muted); font-size:13px; line-height: 1.3}

.meta{
  margin-top:12px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}
.tag{
  font-size:12px;
  color: var(--muted);
  border:1px solid var(--stroke);
  padding:4px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.03);
}
.tag.good{border-color: rgba(49,208,122,.45); color: rgba(49,208,122,.95)}
.tag.warn{border-color: rgba(255,176,32,.55); color: rgba(255,176,32,.95)}
.tag.bad{border-color: rgba(255,77,109,.55); color: rgba(255,77,109,.95)}

.small-list{
  border:1px solid var(--stroke);
  border-radius: var(--radius2);
  background: var(--card);
  box-shadow: var(--shadow2);
  overflow:hidden;
}
.small-list a{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border-top: 1px solid var(--stroke);
  color: var(--muted);
}
.small-list a:first-child{border-top:0}
.small-list a:hover{background: rgba(255,255,255,.05); color: var(--text)}
.small-list .path{color: var(--muted2); font-size:12px}

.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform: translateX(-50%);
  background: rgba(20,24,40,.70);
  border:1px solid var(--stroke);
  backdrop-filter: blur(12px);
  padding:10px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow2);
  color: var(--muted);
  opacity:0;
  pointer-events:none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show{opacity:1; transform: translateX(-50%) translateY(-2px)}

.palette{
  position:fixed;
  inset:0;
  display:none;
  align-items:flex-start;
  justify-content:center;
  padding:72px 16px 16px;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(10px);
}
.palette.open{display:flex}
.palette-panel{
  width:min(820px, 100%);
  border-radius: var(--radius);
  border:1px solid var(--stroke);
  background: rgba(15,18,34,.78);
  box-shadow: var(--shadow);
  overflow:hidden;
}
[data-theme="light"] .palette-panel{background: rgba(255,255,255,.92)}
.palette-head{
  padding:14px 14px;
  border-bottom:1px solid var(--stroke);
  display:flex;
  align-items:center;
  gap:10px;
}
.palette-head input{
  width:100%;
  border:0;
  outline:0;
  background:transparent;
  color: var(--text);
  font-size: 14px;
}
.palette-list{
  max-height: 360px;
  overflow:auto;
}
.palette-item{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:12px 14px;
  border-top:1px solid var(--stroke);
  color: var(--muted);
}
.palette-item:first-child{border-top:0}
.palette-item strong{color: var(--text)}
.palette-item:hover{background: rgba(255,255,255,.06); color: var(--text)}
.palette-item .hint{color: var(--muted2); font-size:12px}

@media (max-width: 980px){
  .shell{grid-template-columns: 1fr}
  .sidebar{position:relative; height:auto}
  .kpis{grid-template-columns: repeat(2, minmax(0,1fr))}
  .grid{grid-template-columns: repeat(2, minmax(0, 1fr))}
}
@media (max-width: 640px){
  .topbar{flex-direction:column; align-items:stretch}
  .actions{justify-content:space-between}
  .grid{grid-template-columns: 1fr}
}
