:root{
  --bg:#0e0f12;
  --panel:#16181d;
  --panel-2:#111319;
  --muted:#8a93a5;
  --text:#eef2ff;
  --brand:#b889ff;
  --ok:#41d392;
  --warn:#ffb84d;
  --bad:#ff6b6b;

  --focus-outline: 2px dashed var(--brand);
  --radius-xl: 1rem;
  --radius-md: .7rem;

  --shadow-1: 0 2px 0 rgba(0,0,0,.2);
  --shadow-2: 0 6px 20px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html,body{ height:100%; }

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font:16px/1.5 system-ui, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a{ color:var(--brand); text-underline-offset: 2px; }
a:hover{ opacity:.9; }

img{ max-width:100%; display:block; }

/* Containers & Structure */
.container{ max-width:1100px; margin-inline:auto; padding:1rem; }
.grid{ display:grid; gap:1rem; }

header, footer{
  background:var(--panel);
  box-shadow: var(--shadow-1);
}
footer{ margin-top: 1rem; }

.panel{
  background:var(--panel);
  border:1px solid #232734;
  border-radius: var(--radius-xl);
  padding:1rem;
}

.panel h2{
  margin:.2rem 0 1rem;
  font-size:1.1rem;
}

/* Skip link for accessibility */
.skip{
  position:absolute;
  left:-9999px; top:-9999px;
}
.skip:focus{
  left:1rem; top:1rem;
  background:#000; color:#fff;
  padding:.5rem 1rem; border-radius:.5rem;
  z-index:9999;
}

/* brand left, links right */
nav {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

/* push all following links to the right */
nav .brand {
  margin-right: auto;   /* <-- key line */
  font-weight: 700;
}

/* optional: a bit more space on wider screens */
@media (min-width: 768px) {
  nav a { margin-left: .25rem; }
}

nav a{
  color:var(--text);
  text-decoration:none;
  padding:.5rem .75rem;
  border-radius:.6rem;
}
nav a:hover{ background:#1f232b; transition: background .2s; }
nav a:focus{ outline: var(--focus-outline); outline-offset:2px; }

/* Forms & Controls */
label{ display:block; margin:.4rem 0 .25rem; }
input, select, textarea, button{
  font: inherit;
}

input, select, textarea{
  width:100%;
  padding:.6rem .7rem;
  border-radius: var(--radius-md);
  border:1px solid #2a2f3a;
  background:#0f1218;
  color:var(--text);
}
input:focus, select:focus, textarea:focus{
  outline: var(--focus-outline);
  outline-offset: 2px;
}

.btn{
  background:var(--brand);
  color:#090b10;
  border:0;
  padding:.55rem 1rem;
  border-radius: var(--radius-md);
  cursor:pointer;
  box-shadow: var(--shadow-1);
}
.btn.secondary{ background:#2a2f3a; color:var(--text); }
.btn.danger{ background:var(--bad); color:#0b0d10; }
.btn:focus{ outline: var(--focus-outline); outline-offset:2px; }
.btn:hover{ filter: brightness(1.05); }

/* Layout helpers */
.row{ display:grid; gap:.8rem; }
.row.cols-2{ grid-template-columns: 1fr 1fr; }
.row.cols-3{ grid-template-columns: repeat(3, 1fr); }
.mt-1{ margin-top:1rem; }
.right{ justify-self:end; }
.center{ text-align:center; }

/* Status text */
.muted{ color:var(--muted); }
.ok{ color:var(--ok); }
.warn{ color:var(--warn); }
.bad{ color:var(--bad); min-height:1.2em; }

/* Stats */
.stat{ font-size:1.6rem; }

/* Mini bars chart */
.bars{
  display:flex;
  align-items:flex-end;
  height:80px;
  gap:.3rem;
}
.bar{
  flex:1; min-width:0;
  background: linear-gradient(180deg, var(--brand), #5b2bbf);
  border-radius:.4rem .4rem 0 0;
  transition: height .3s ease;
  box-shadow: var(--shadow-2);
}

/* Table → Responsive Cards */
table{
  width:100%;
  border-collapse: collapse;
  background: var(--panel-2);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
caption{ padding:.6rem; color:var(--muted); text-align:left; }
thead th{
  font-size:.9rem;
  text-align:left;
  padding:.6rem .8rem;
  border-bottom:1px solid #2a2f3a;
  background: #151821;
}
tbody td{
  padding:.6rem .8rem;
  border-bottom:1px solid #232734;
  vertical-align: top;
}
tbody tr:hover{ background:#141821; }
.th-sort{ cursor:pointer; }
.actions{ display:flex; gap:.4rem; justify-content:flex-end; }

/* Highlighted search matches */
mark{
  background:#ffeb3b33;
  color:inherit;
  padding:0 .1em;
  border-radius:.2rem;
}

/* Focus visibility for interactive cells */
[tabindex="0"]:focus, .th-sort:focus{
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* Mobile card layout */
@media (max-width: 768px){
  table thead{ display:none; }
  table, tbody, tr, td{ display:block; width:100%; }
  tbody tr{
    margin:.7rem 0;
    border:1px solid #232734;
    border-radius:.8rem;
    overflow: hidden;
    background: var(--panel);
  }
  tbody td{
    display:flex;
    gap:.8rem;
    justify-content:space-between;
    border-bottom:1px solid #232734;
  }
  tbody td:last-child{ border-bottom: 0; }
  tbody td::before{
    content: attr(data-label);
    color: var(--muted);
    padding-right:.8rem;
    min-width: 7rem;
  }
  .actions{ justify-content:flex-start; }
}

/* Inputs grouping (nice visual rhythm) */
.panel form > .row:not(:last-child){
  margin-bottom:.6rem;
}

/* Animations / micro-interactions */
.panel{
  transition: transform .2s ease, box-shadow .2s ease;
}
.panel:focus-within{
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}

/* Utility visibility for screen readers */
.sr-only{
  position:absolute; width:1px; height:1px;
  padding:0; margin:-1px; overflow:hidden;
  clip: rect(0 0 0 0); white-space:nowrap; border:0;
}

/* Footer */
footer small{ color:var(--muted); }

/* Optional wider screens polish */
@media (min-width: 1024px){
  .container{ padding: 1.25rem; }
}

