@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root{
  --bg:#EEF3FA;
  --surface:#FFFFFF;
  --surface-2:#F6F9FD;
  --text:#16223A;
  --muted:#64748B;
  --border:#E1E8F2;
  --accent:#145FD1;
  --accent-2:#17C3E6;
  --accent-soft:#E8F1FE;
  --success:#12B76A;
  --success-soft:#E7F9F1;
  --danger:#E23B3B;
  --danger-soft:#FDECEC;
  --warning:#B7791C;
  --warning-soft:#FDF3E1;
  --shadow: 0 1px 2px rgba(20,32,58,.06), 0 8px 24px -12px rgba(20,32,58,.12);
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#0A1220;
    --surface:#101B2D;
    --surface-2:#16233A;
    --text:#E7EEFB;
    --muted:#93A4C0;
    --border:#1E2C45;
    --accent:#4C9EFF;
    --accent-2:#35E3F0;
    --accent-soft:#142A4A;
    --success:#34D399;
    --success-soft:#0F3D2E;
    --danger:#F87171;
    --danger-soft:#4A1C1C;
    --warning:#FBBF6B;
    --warning-soft:#4A3411;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 28px -14px rgba(0,0,0,.55);
  }
}

*{box-sizing:border-box}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:'IBM Plex Sans', system-ui, sans-serif;
  min-height:100vh;
}
a{color:var(--accent); text-decoration:none}
a:hover{text-decoration:underline}
h1,h2,h3{font-family:'Sora',system-ui,sans-serif; margin:0}
.mono{font-family:'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric:tabular-nums;}

/* ---------- Login ---------- */
.login-wrap{min-height:100vh; display:flex; align-items:center; justify-content:center; padding:16px;}
.login-card{width:100%; max-width:360px;}
.login-card .brand-logo{display:block; max-width:180px; margin:0 auto 18px;}
.login-card h1{font-size:18px; text-align:center; margin-bottom:18px; color:var(--muted); font-weight:600;}

.card{background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:24px; box-shadow:var(--shadow);}

/* ---------- Dev portal link cards ---------- */
.devlink{
  display:flex; align-items:center; gap:14px; padding:14px 16px; border-radius:12px;
  border:1px solid var(--border); background:var(--surface); text-decoration:none; color:var(--text);
  transition:border-color .15s ease, background .15s ease, transform .15s ease;
}
.devlink:hover{border-color:var(--accent); background:var(--surface-2); transform:translateY(-1px);}
.devlink-icon{
  width:42px; height:42px; border-radius:11px; display:flex; align-items:center; justify-content:center;
  background:var(--accent-soft, rgba(20,95,209,.1)); flex:none;
}
.devlink-icon svg{width:21px; height:21px; stroke:var(--accent); flex:none;}
.devlink-text{flex:1; min-width:0;}
.devlink-name{font-weight:700; font-size:14.5px; display:block;}
.devlink-desc{font-size:12.5px; color:var(--muted); display:block; margin-top:2px;}
.devlink-arrow{flex:none; display:flex;}
.devlink-arrow svg{width:16px; height:16px; stroke:var(--muted); flex:none;}
.devlink:hover .devlink-arrow svg{stroke:var(--accent);}

form input, form select{
  width:100%; padding:10px 12px; margin-bottom:12px; border-radius:8px;
  border:1px solid var(--border); background:var(--surface-2); color:var(--text);
  font-family:inherit; font-size:14px;
}
form button, .btn{
  display:inline-flex; align-items:center; gap:7px; white-space:nowrap;
  padding:9px 16px; border-radius:9px; border:1px solid var(--accent);
  background:var(--accent); color:#fff; cursor:pointer; font-size:14px; font-weight:600;
  font-family:inherit;
}
.btn.danger{background:var(--danger); border-color:var(--danger)}
.btn.ghost{background:transparent; color:var(--text); border-color:var(--border)}
.btn.small{padding:5px 11px; font-size:12.5px}
.btn svg{width:15px; height:15px; stroke:currentColor; flex:none;}
.btn.ghost.active{background:var(--accent); color:#fff; border-color:var(--accent);}

.error{background:var(--danger-soft); border:1px solid var(--danger); color:var(--danger); padding:9px 13px; border-radius:9px; margin-bottom:14px; font-size:13.5px;}
.success{background:var(--success-soft); border:1px solid var(--success); color:var(--success); padding:9px 13px; border-radius:9px; margin-bottom:14px; font-size:13.5px;}

/* ---------- Shell (sidebar + main) ---------- */
.shell{display:grid; grid-template-columns:248px 1fr; min-height:100vh;}

aside{
  background:var(--surface); border-right:1px solid var(--border);
  padding:20px 14px; display:flex; flex-direction:column; gap:22px;
}
.brand{display:flex; align-items:center; justify-content:center; padding:14px 10px 8px;}
.brand img{width:100%; max-width:158px; display:block;}

nav{display:flex; flex-direction:column; gap:2px;}
.navlabel{font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); padding:14px 12px 6px;}
.navitem{
  display:flex; align-items:center; gap:11px; padding:9px 12px; border-radius:10px;
  color:var(--muted); text-decoration:none; font-size:14.5px; font-weight:500; position:relative;
}
.navitem svg{width:18px; height:18px; flex:none; stroke:currentColor;}
.navitem.active{background:var(--accent-soft); color:var(--accent);}
.navitem.active::before{content:""; position:absolute; left:-14px; top:8px; bottom:8px; width:3px; background:var(--accent); border-radius:0 3px 3px 0;}
.navitem:not(.active):hover{background:var(--surface-2); color:var(--text);}

.sidebar-foot{margin-top:auto; padding:12px; border-top:1px solid var(--border); font-size:12px; color:var(--muted); line-height:1.6;}
.sidebar-foot b{color:var(--text)}

main{padding:22px 28px 40px; min-width:0;}
.topbar{display:flex; align-items:center; justify-content:space-between; margin-bottom:22px; gap:16px; flex-wrap:wrap;}
.crumb{font-size:12.5px; color:var(--muted); margin-bottom:4px;}
.crumb b{color:var(--text); font-weight:600;}
.topbar h1{font-size:24px; font-weight:700;}
.topbar-right{display:flex; align-items:center; gap:12px;}
.avatar{
  width:36px; height:36px; border-radius:50%;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  display:flex; align-items:center; justify-content:center; color:#fff;
  font-weight:700; font-size:13px; font-family:'Sora',sans-serif;
}

/* ---------- Stat tiles ---------- */
.stats{display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:22px;}
.stat{background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:16px 18px; box-shadow:var(--shadow);}
.stat .lbl{font-size:12.5px; color:var(--muted); display:flex; align-items:center; gap:6px; margin-bottom:8px;}
.stat .lbl svg{width:14px; height:14px; stroke:currentColor}
.stat .num{font-family:'Sora',sans-serif; font-size:26px; font-weight:700; font-variant-numeric:tabular-nums;}
.stat .sub{font-size:12px; color:var(--muted); margin-top:2px;}

.meter{height:6px; border-radius:3px; background:var(--surface-2); overflow:hidden;}
.meter i{display:block; height:100%; border-radius:3px; background:var(--accent);}

/* ---------- Console modal ---------- */
.console-modal{
  position:fixed; inset:0; background:rgba(10,15,25,.6); z-index:100;
  display:flex; align-items:center; justify-content:center; padding:20px;
}
.console-modal[hidden]{display:none;}
.console-modal-box{
  background:var(--surface); border-radius:14px; border:1px solid var(--border);
  width:95vw; max-width:1500px; box-shadow:var(--shadow); overflow:hidden;
  display:flex; flex-direction:column;
}
.console-modal-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px; border-bottom:1px solid var(--border);
}
.console-modal-head h3{font-size:15px;}
.console-modal-close{
  background:none; border:none; color:var(--muted); font-size:22px; line-height:1; cursor:pointer; padding:2px 6px;
}
.console-modal-close:hover{color:var(--text);}
.console-modal iframe{width:100%; height:85vh; border:none; display:block;}
.console-toolbar{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px;}

/* ---------- VPS detail: head / specs strip / tabs / menu ---------- */
.vps-head{display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:16px; flex-wrap:wrap;}
.vps-head .vps-actions{display:flex; gap:8px; align-items:center; flex-wrap:wrap; position:relative;}

.specs-strip{display:flex; gap:0; flex-wrap:wrap;}
.specs-strip .spec{
  flex:1 1 140px; display:flex; align-items:center; gap:10px;
  padding:14px 18px; border-right:1px solid var(--border);
}
.specs-strip .spec:last-child{border-right:none;}
.specs-strip .spec svg{width:20px; height:20px; stroke:var(--muted); flex:none;}
.specs-strip .spec .k{font-size:11.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em;}
.specs-strip .spec .v{font-family:'IBM Plex Mono',monospace; font-size:15px; font-weight:500;}
@media (max-width:700px){ .specs-strip .spec{border-right:none; border-bottom:1px solid var(--border);} }

.tabs{display:flex; gap:4px; border-bottom:1px solid var(--border); margin:20px 0 16px;}
.tabbtn{
  background:none; border:none; padding:10px 4px; margin-right:20px; font-family:inherit; font-size:14px; font-weight:500;
  color:var(--muted); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px;
}
.tabbtn:hover{color:var(--text);}
.tabbtn.active{color:var(--accent); border-bottom-color:var(--accent);}
.tabpanel[hidden]{display:none;}

.periodtabs{display:inline-flex; background:var(--surface-2); border-radius:9px; padding:3px; gap:2px; margin-bottom:16px;}
.periodbtn{
  background:none; border:none; padding:7px 16px; border-radius:7px; font-family:inherit; font-size:13px;
  font-weight:500; color:var(--muted); cursor:pointer;
}
.periodbtn.active{background:var(--surface); color:var(--text); box-shadow:var(--shadow);}
.perfpanel[hidden]{display:none;}
.chart-card h4{font-size:13.5px; color:var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:.03em; margin-bottom:10px;}

.kv{display:flex; flex-direction:column; gap:0;}
.kv-row{display:flex; align-items:center; justify-content:space-between; padding:11px 0; border-bottom:1px solid var(--border); gap:12px; flex-wrap:wrap;}
.kv-row:last-child{border-bottom:none;}
.kv-row .k{color:var(--muted); font-size:13.5px;}
.kv-row .v{font-family:'IBM Plex Mono',monospace; font-size:14px; display:flex; align-items:center; gap:8px;}
.kv-row .v a{font-family:'IBM Plex Sans',sans-serif;}
.copybtn{background:none; border:none; color:var(--muted); cursor:pointer; padding:2px; display:inline-flex;}
.copybtn:hover{color:var(--accent);}
.copybtn svg{width:14px; height:14px; stroke:currentColor;}

.menu-wrap{position:relative; display:inline-block;}
.menu-dropdown{
  position:absolute; right:0; top:calc(100% + 6px); background:var(--surface); border:1px solid var(--border);
  border-radius:10px; box-shadow:var(--shadow); min-width:210px; z-index:20; padding:6px;
}
.menu-dropdown[hidden]{display:none;}
.menu-dropdown form, .menu-dropdown .menu-item{margin:0;}
.menu-dropdown button{
  width:100%; text-align:left; background:none; border:none; padding:8px 10px; border-radius:7px;
  font-family:inherit; font-size:13.5px; color:var(--text); cursor:pointer;
  display:flex; align-items:center; gap:8px; white-space:nowrap;
}
.menu-dropdown button svg{width:14px; height:14px; stroke:currentColor; flex:none;}
.menu-dropdown button:hover{background:var(--surface-2);}
.menu-dropdown button.danger{color:var(--danger);}

/* ---------- Card / table ---------- */
.panel{background:var(--surface); border:1px solid var(--border); border-radius:14px; box-shadow:var(--shadow); overflow:hidden; margin-bottom:20px;}
.panel-head{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 18px; border-bottom:1px solid var(--border); flex-wrap:wrap;}
.panel-head h2{font-size:16px; display:flex; align-items:center; gap:8px;}
.panel-head h2 svg, h3 svg{width:16px; height:16px; stroke:currentColor; flex:none; vertical-align:middle;}
.panel-body{padding:20px;}

.tablewrap{overflow-x:auto;}
table{width:100%; border-collapse:collapse;}
th{text-align:left; font-size:11.5px; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); font-weight:600; padding:11px 18px; border-bottom:1px solid var(--border); background:var(--surface-2); white-space:nowrap;}
td{padding:12px 18px; border-bottom:1px solid var(--border); font-size:14px; vertical-align:middle;}
tr:last-child td{border-bottom:none}
tbody tr:hover{background:var(--surface-2)}

.host{display:flex; flex-direction:column; gap:2px;}
.host b{font-weight:600}
.host span{font-size:12px; color:var(--muted)}

.chip{display:inline-flex; align-items:center; gap:5px; background:var(--surface-2); border:1px solid var(--border); padding:3px 8px; border-radius:7px; font-size:12px; color:var(--text); white-space:nowrap; margin:2px 6px 2px 0;}
.chip svg{width:12px; height:12px; stroke:var(--muted); flex:none;}

.pill{display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:999px; font-size:12.5px; font-weight:600; white-space:nowrap;}
.pill.on{background:var(--success-soft); color:var(--success);}
.pill.off{background:var(--danger-soft); color:var(--danger);}
.pill.warn{background:var(--warning-soft); color:var(--warning);}
.pill i{width:6px; height:6px; border-radius:50%; background:currentColor;}

.actions{display:flex; gap:6px; flex-wrap:wrap;}
.actions form{display:inline; margin:0;}
.iconbtn{
  width:30px; height:30px; border-radius:8px; border:1px solid var(--border);
  background:var(--surface); display:inline-flex; align-items:center; justify-content:center;
  color:var(--muted); cursor:pointer;
}
.iconbtn svg{width:15px; height:15px; stroke:currentColor; flex:none;}
.iconbtn:hover{border-color:var(--accent); color:var(--accent); background:var(--accent-soft)}
.iconbtn.danger:hover{border-color:var(--danger); color:var(--danger); background:var(--danger-soft)}

.grid{display:grid; gap:16px;}
.grid.cols-2{grid-template-columns:1fr 1fr;}
@media (max-width:860px){ .grid.cols-2{grid-template-columns:1fr;} }

form.inline-form{display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:0;}
form.inline-form input, form.inline-form select{width:auto; margin:0;}

@media (max-width:860px){
  .shell{grid-template-columns:76px 1fr;}
  .brand img{display:none}
  .brand::after{content:"L"; font-family:'Sora',sans-serif; font-weight:800; color:var(--accent); font-size:20px}
  .navitem span{display:none}
  .navlabel{display:none}
  .stats{grid-template-columns:repeat(2,1fr)}
  main{padding:18px 14px 32px}
}
