:root{
  --bg: #0b1020;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.08);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.62);
  --border: rgba(255,255,255,0.12);

  --green: #2ee59d;
  --red: #ff4d6d;
  --orange: #ffb703;
  --blue: #4ea1ff;

  --shadow: 0 12px 40px rgba(0,0,0,0.35);
  --r: 18px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(78,161,255,0.18), transparent 60%),
              radial-gradient(900px 500px at 90% 10%, rgba(46,229,157,0.14), transparent 55%),
              radial-gradient(800px 500px at 60% 110%, rgba(255,77,109,0.10), transparent 55%),
              var(--bg);
  color: var(--text);
}

.container{
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.topbar{
  display:flex;
  gap:12px;
  align-items:stretch;
  flex-wrap:wrap;
}

.card{
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

/* HERO */
.hero{
  flex: 1 1 620px;
  padding: 16px 16px 12px;
  position:relative;
  overflow:hidden;
}

.hero:before{
  content:"";
  position:absolute;
  inset:-60px -80px auto auto;
  width:260px;
  height:260px;
  background: radial-gradient(circle, rgba(78,161,255,0.18), transparent 65%);
  filter: blur(2px);
  pointer-events:none;
}

.hero-head{
  display:flex;
  gap:14px;
  align-items:flex-start;
}

.hero-logo{
  flex: 0 0 auto;
  width: 112px;
  height: 112px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.14);
  background: #ffffff;              /* make transparent PNG pop */
  display:flex;
  margin-top: 8px;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}

.hero-logo img{
  width: 92%;
  height: 92%;
  object-fit: contain;
}

.hero-main{
  flex: 1 1 auto;
  min-width: 260px;
}

.hero-title{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
}

h1{
  font-size: 16px;
  margin:0;
  letter-spacing:0.3px;
  color: var(--muted);
  font-weight: 650;
}

.wan{
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 0.5px;
  margin: 6px 0 4px;
  line-height:1.0;
}

.meta{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  font-size: 12px;
  font-weight: 800;
  letter-spacing:0.2px;
}

.dot{
  width:10px; height:10px; border-radius:999px;
  box-shadow: 0 0 18px rgba(255,255,255,0.12);
}
.dot.green{ background: var(--green); }
.dot.red{ background: var(--red); }
.dot.orange{ background: var(--orange); }
.dot.blue{ background: var(--blue); }

.banner{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,77,109,0.35);
  background: rgba(255,77,109,0.10);
  color: rgba(255,255,255,0.92);
  font-weight: 900;
  letter-spacing: 0.25px;
  display:none;
}
.banner.show{ display:block; }

/* SIDE */
.side{
  flex: 0 0 320px;
  padding: 12px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.controls{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.input{
  width:100%;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.22);
  color: var(--text);
  outline:none;
}

.rowbtns{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}

.btn{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-weight: 850;
  cursor:pointer;
}
.btn.active{
  background: rgba(78,161,255,0.16);
  border-color: rgba(78,161,255,0.30);
}

.summary{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:8px;
}
.sumitem{
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-weight: 850;
  letter-spacing:0.2px;
  font-size: 12px;
}
.sumitem .k{ color: var(--muted); font-weight: 800; }
.sumitem .v{ font-weight: 950; }

.small{
  color: var(--muted);
  font-size: 12px;
}

/* Sections */
.section{
  margin-top: 12px;
  padding: 10px;
}

.section-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom: 8px;
}

.section-head h2{
  margin:0;
  font-size: 16px;       /* bigger heading */
  font-weight: 950;
  letter-spacing:0.5px;
}

.count{
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

/* Status rows */
.list{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.row{
  display:flex;
  gap:10px;
  align-items:center;
  padding: 8px 10px 8px 16px;  /* indent device rows */
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.16);
}

.left{
  flex: 0 1 auto;     /* don't consume all width */
  min-width: 0;       /* allow shrinking in 4-col */
}

.right{
  display:flex;
  flex-direction:column;
  gap:4px;
  align-items:flex-end;
  min-width: 84px;
  margin-left: auto;
}

.name{
  font-weight: 950;
  letter-spacing: 0.2px;
  font-size: 13px;
}
.desc{
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
}

.pill{
  padding: 6px 9px;
  border-radius: 999px;
  font-weight: 950;
  font-size: 11px;
  letter-spacing: 0.35px;
  border: 2px solid rgba(255,255,255,0.12); /* thicker border for visibility */
  text-transform: uppercase;
}

/* Border colors match dot vars exactly */
.pill.up{ background: rgba(46,229,157,0.16); border-color: var(--green); }
.pill.down{ background: rgba(255,77,109,0.16); border-color: var(--red); }
.pill.unknown{ background: rgba(255,183,3,0.14); border-color: var(--orange); }
.pill.ack{ background: rgba(78,161,255,0.16); border-color: var(--blue); }

.chips{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top: 6px;
}
.chip{
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.72);
  font-size: 11px;
  font-weight: 850;
}

.upstream{
  border-color: rgba(255,183,3,0.35);
  background: rgba(255,183,3,0.10);
  color: rgba(255,255,255,0.86);
}

.chips-flags{ margin-top: 6px; }
.chips-parents{ margin-top: 6px; }

/* Detailed mode: always show details */
body[data-density="detailed"] .row .desc,
body[data-density="detailed"] .row .chips{
  display:block;
}

/* Compact mode: hide details until hover/focus */
body[data-density="compact"] .row .desc,
body[data-density="compact"] .row .chips{
  display:none;
}
body[data-density="compact"] .row:hover .desc,
body[data-density="compact"] .row:hover .chips,
body[data-density="compact"] .row:focus-within .desc,
body[data-density="compact"] .row:focus-within .chips{
  display:block;
}



/* Desktop: status in 4 columns */
@media (min-width: 1000px){
  #viewStatus{
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)); /* prevents overflow */
    gap: 12px;
    align-items: start;
  }
  #viewStatus .section{
    margin-top: 0;
    min-width: 0; /* allow cards to shrink in grid */
  }
}

/* Mobile hero layout: stack + center logo + keep dark background */
@media (max-width: 600px){
  .hero-head{
    flex-direction: column;     /* stack logo above text */
    align-items: center;
    gap: 12px;
  }

  .hero-logo{
    width: 96px;
    height: 96px;
    border-radius: 18px;
    background: #ffffff;        /* only the tile is white */
    padding: 10px;              /* creates nice breathing room */
  }

  .hero-logo img{
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .hero-main{
    width: 100%;
    min-width: 0;
  }

  .hero-title{
    width: 100%;
    justify-content: space-between;
  }

  h1{
    width: 100%;
    text-align: center;         /* looks like your “what I was thinking” shot */
  }

  .wan{
    text-align: center;
    font-size: 36px;
  }

  .meta{
    justify-content: center;    /* badges centered under FIBER */
  }

  .meta .badge{
    white-space: nowrap;        /* stops “Last check-in:” breaking weirdly */
  }
  
  .hero-title{
    flex-direction: column;     /* stack title + WAN */
    align-items: center;        /* center both */
    justify-content: center;
    gap: 10px;
  }

  .badge{
    align-self: center;         /* ensure WAN badge centers */
  }
}

/* extra-small phones */
@media (max-width: 380px){
  .hero-logo{ width: 84px; height: 84px; }
  .wan{ font-size: 32px; }
  .meta .badge{ white-space: normal; } /* allow wrap if truly tiny */
}

/* Topology */
.tree{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.tnode{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 8px 10px 8px 16px; /* match indent feel */
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.14);
}

.indent{
  width: calc(var(--depth) * 18px);
  height: 1px;
}

.branch{
  width: 10px; height: 10px;
  border-left: 2px solid rgba(255,255,255,0.22);
  border-bottom: 2px solid rgba(255,255,255,0.22);
  transform: translateY(-1px);
}

.tmain{ flex:1; min-width:200px; }
.tmeta{ display:flex; gap:8px; align-items:center; }

.flash{
  animation: flash 0.6s ease-in-out;
}
@keyframes flash {
  from { filter: brightness(1.25); }
  to { filter: brightness(1.0); }
}