:root{
  --bg:#0A1420; --bg-card:#132335; --bg-card-hover:#1A2D42; --line:#22384E;
  --blue:#2E8FE0; --teal:#29ABE2; --ink:#F2F4F7; --muted:#8DA0B5;
  --danger:#D42E3F; --success:#29ABE2; --sidebar-w:230px;
}
*{box-sizing:border-box;}
body{ margin:0; background:var(--bg); color:var(--ink); font-family:'IBM Plex Sans', sans-serif; }
.mono{ font-family:'IBM Plex Mono', monospace; }
h1,h2,h3{ font-family:'Space Grotesk', sans-serif; }
a{ color:inherit; text-decoration:none; }

/* ---------- Layout auth (login/register) ---------- */
.auth-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px; }
.auth-box{ background:var(--bg-card); border:1px solid var(--line); padding:36px; border-radius:14px; width:100%; max-width:380px; }
.auth-box .brand-logo{ display:flex; justify-content:center; margin-bottom:24px; }
.auth-box .brand-logo img{ height:44px; }
.auth-box h2{ text-align:center; margin:0 0 24px; font-size:20px; font-weight:600; }

/* ---------- Forms (shared) ---------- */
label{ font-size:12.5px; color:var(--muted); margin-bottom:6px; display:block; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select{
  width:100%; padding:12px 14px; border-radius:8px; border:1px solid var(--line);
  background:#0E1B29; color:var(--ink); font-family:inherit; font-size:14.5px; margin:0 0 14px; box-sizing:border-box;
}
input:focus, textarea:focus, select:focus{ outline:none; border-color:var(--blue); }
textarea{ resize:vertical; min-height:100px; }

.btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:12px 20px; border-radius:8px; font-size:14px; font-weight:600; border:none; cursor:pointer; text-decoration:none; }
.btn-primary{ background:var(--blue); color:#fff; width:100%; }
.btn-primary:hover{ background:#3f9fef; }
.btn-secondary{ background:#e6982e; color:#fff; }
.btn-danger{ background:var(--danger); color:#fff; }
.btn-ghost{ background:rgba(255,255,255,.04); color:var(--ink); border:1px solid var(--line); }
.btn-ghost:hover{ border-color:var(--teal); }

.error-box{ background:rgba(212,46,63,.14); color:#ff8b8b; padding:10px 14px; border-radius:8px; font-size:13.5px; margin-top:10px; }
.message-box{ background:rgba(46,143,224,.14); color:var(--teal); padding:12px 14px; border-radius:8px; font-size:14px; margin-bottom:16px; }
.hint{ color:var(--muted); font-size:13px; }
.divider{ text-align:center; color:#556; font-size:12px; margin:18px 0; position:relative; }
.divider::before, .divider::after{ content:''; position:absolute; top:50%; width:40%; height:1px; background:var(--line); }
.divider::before{ left:0; } .divider::after{ right:0; }

/* ---------- Sidebar layout (app pages) ---------- */
.sidebar{ position:fixed; top:0; left:0; bottom:0; width:var(--sidebar-w); background:#071119; border-right:1px solid var(--line); display:flex; flex-direction:column; padding:20px 14px; }
.brand{ display:flex; align-items:center; gap:10px; margin-bottom:28px; padding:0 8px; }
.brand img{ height:34px; width:auto; }
.nav-item{ display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:8px; color:var(--muted); font-size:14px; margin-bottom:2px; }
.nav-item svg{ flex:none; width:18px; height:18px; }
.nav-item:hover{ background:rgba(255,255,255,.04); color:var(--ink); }
.nav-item.active{ background:rgba(46,143,224,.14); color:var(--blue); }
.sidebar-footer{ margin-top:auto; }
.health-card{ background:var(--bg-card); border:1px solid var(--line); border-radius:10px; padding:14px; }
.health-card .label{ font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin-bottom:8px; }
.health-row{ display:flex; align-items:center; gap:8px; }
.pulse-dot{ width:8px; height:8px; border-radius:50%; background:var(--teal); position:relative; flex:none; }
.pulse-dot::after{ content:''; position:absolute; inset:-4px; border-radius:50%; border:1px solid var(--teal); animation:pulse 2s ease-out infinite; }
@keyframes pulse{ 0%{ opacity:.8; transform:scale(.6); } 100%{ opacity:0; transform:scale(1.8); } }
.health-card .count{ font-family:'IBM Plex Mono', monospace; font-size:15px; }
.user-chip{ display:flex; align-items:center; gap:8px; padding:10px 8px; font-size:12px; color:var(--muted); margin-top:12px; }
.avatar{ width:26px; height:26px; border-radius:50%; background:var(--blue); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:600; font-size:12px; flex:none; }
.logout-link{ color:var(--danger); font-size:12px; margin-top:6px; display:inline-block; padding:0 8px; }

.main{ margin-left:var(--sidebar-w); padding:28px 36px; }
.topbar{ display:flex; justify-content:space-between; align-items:center; margin-bottom:28px; flex-wrap:wrap; gap:14px; }
.topbar h1{ font-size:24px; margin:0; font-weight:600; }

/* ---------- Cards (routers, generic content boxes) ---------- */
.grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:18px; }
.card{ background:var(--bg-card); border:1px solid var(--line); border-radius:12px; padding:20px; }
.card h3{ margin:0 0 4px; font-size:16px; font-weight:600; }
.status{ display:flex; align-items:center; gap:6px; font-size:12.5px; font-weight:600; }
.status.online{ color:var(--teal); } .status.offline{ color:var(--danger); } .status.unknown{ color:var(--muted); }
.dot{ width:6px; height:6px; border-radius:50%; background:currentColor; }
.meta-row{ font-size:12.5px; color:var(--muted); margin:3px 0; font-family:'IBM Plex Mono', monospace; }
.alert-chip{ display:inline-flex; align-items:center; gap:6px; background:rgba(212,46,63,.14); color:var(--danger); font-size:12px; padding:5px 10px; border-radius:6px; margin-top:10px; }
code{ background:#0E1B29; padding:4px 8px; border-radius:4px; font-family:'IBM Plex Mono', monospace; }

.action-btn{ display:inline-flex; align-items:center; gap:6px; padding:8px 12px; border-radius:7px; font-size:12.5px; background:rgba(255,255,255,.04); color:var(--ink); border:1px solid var(--line); cursor:pointer; text-decoration:none; }
.action-btn:hover{ background:rgba(255,255,255,.08); border-color:var(--teal); }
.action-btn.primary{ background:rgba(46,143,224,.16); border-color:transparent; color:var(--blue); }

.more-menu{ position:relative; }
.menu-btn{ background:none; border:none; color:var(--muted); cursor:pointer; padding:4px; border-radius:6px; }
.menu-btn:hover{ background:rgba(255,255,255,.06); color:var(--ink); }
.dropdown{ display:none; position:absolute; right:0; top:calc(100% + 6px); background:#071119; border:1px solid var(--line); border-radius:8px; min-width:170px; overflow:hidden; z-index:10; box-shadow:0 12px 24px rgba(0,0,0,.4); }
.more-menu:hover .dropdown, .more-menu:focus-within .dropdown{ display:block; }
.dropdown a, .dropdown button{ display:flex; width:100%; align-items:center; gap:8px; padding:10px 14px; font-size:13px; color:var(--ink); background:none; border:none; text-align:left; cursor:pointer; text-decoration:none; }
.dropdown a:hover, .dropdown button:hover{ background:rgba(255,255,255,.05); }
.dropdown .danger{ color:var(--danger); }
.dropdown hr{ border:none; border-top:1px solid var(--line); margin:4px 0; }

.empty{ text-align:center; padding:60px 20px; color:var(--muted); }
table{ width:100%; border-collapse:collapse; background:var(--bg-card); border-radius:10px; overflow:hidden; }
th, td{ padding:12px; text-align:left; border-bottom:1px solid var(--line); font-size:14px; }
th{ background:#0E1B29; }

@media (max-width:880px){
  .sidebar{ display:none; }
  .main{ margin-left:0; padding:20px; }
}

/* ---------- Mobile top bar (visible uniquement <880px) ---------- */
.mobile-topbar{ display:none; }
@media (max-width:880px){
  .mobile-topbar{
    display:flex; align-items:center; justify-content:space-between;
    background:#071119; border-bottom:1px solid var(--line); padding:12px 16px;
    position:sticky; top:0; z-index:50;
  }
  .mobile-topbar img{ height:28px; }
  .mobile-burger{ background:none; border:none; color:var(--ink); cursor:pointer; padding:6px; }
  .mobile-nav{
    display:none; position:fixed; top:52px; left:0; right:0; bottom:0; z-index:49;
    background:#071119; padding:16px; overflow-y:auto;
  }
  .mobile-nav.open{ display:block; }
  .mobile-nav .nav-item{ font-size:15px; padding:14px 12px; }
  .mobile-nav .health-card{ margin-top:16px; }
  .mobile-nav .user-chip{ margin-top:16px; }
}
