:root{
  --bg:#07101d;
  --bg-soft:#0a1422;
  --sidebar:#0a1525;
  --panel:#0d1a2c;
  --panel-2:#101f34;
  --line:#1c304a;
  --line-soft:#16283e;
  --text:#eaf2ff;
  --muted:#8297b4;
  --muted-2:#607896;
  --primary:#3b82f6;
  --primary-dark:#2563eb;
  --success:#34d399;
  --danger:#ef4444;
  --warning:#f59e0b;
  --radius:14px;
  --shadow:0 18px 45px rgba(0,0,0,.18);
}

*{box-sizing:border-box}
html{min-height:100%;background:var(--bg)}
body{
  margin:0;
  min-height:100vh;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  background:
    radial-gradient(circle at 80% 0,rgba(37,99,235,.10),transparent 32rem),
    var(--bg);
  color:var(--text);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
button,input,select,textarea{font:inherit}
a{color:inherit}

.app{min-height:100vh}

.sidebar{
  position:fixed;
  inset:0 auto 0 0;
  width:272px;
  padding:18px 14px 22px;
  overflow-y:auto;
  background:linear-gradient(180deg,#0b1728 0%,#091322 100%);
  border-right:1px solid var(--line);
  box-shadow:8px 0 32px rgba(0,0,0,.12);
  z-index:50;
  scrollbar-width:thin;
  scrollbar-color:#28405f transparent;
}
.sidebar::-webkit-scrollbar{width:6px}
.sidebar::-webkit-scrollbar-thumb{background:#28405f;border-radius:99px}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-height:66px;
  padding:7px 10px 20px;
  border-bottom:1px solid rgba(255,255,255,.045);
  margin-bottom:10px;
}
.logo{
  flex:0 0 auto;
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border-radius:13px;
  background:linear-gradient(135deg,#2563eb,#06b6d4);
  box-shadow:0 8px 24px rgba(37,99,235,.28);
  font-weight:900;
  font-size:21px;
  color:white;
}
.brand b{font-size:16px;letter-spacing:.4px}
.brand small{display:block;margin-top:2px;color:#6982a2;font-size:9px;font-weight:700;letter-spacing:1.8px}

nav{padding-bottom:24px}
nav a{
  display:flex;
  align-items:center;
  min-height:42px;
  padding:10px 12px;
  margin:3px 0;
  border:1px solid transparent;
  border-radius:10px;
  color:#b8c8dd;
  text-decoration:none;
  font-size:13px;
  font-weight:600;
  transition:background .16s ease,border-color .16s ease,color .16s ease,transform .16s ease;
}
nav a:hover{background:#10243d;border-color:#173653;color:#fff;transform:translateX(2px)}
nav a.active{background:linear-gradient(90deg,rgba(37,99,235,.26),rgba(14,165,233,.10));border-color:#285083;color:#fff;box-shadow:inset 3px 0 0 #3b82f6}
.nav-title{padding:18px 12px 7px;color:#5f7898;font-size:9px;font-weight:800;letter-spacing:1.45px}

.main{min-height:100vh;margin-left:272px}
.top{
  position:sticky;
  top:0;
  z-index:30;
  min-height:82px;
  display:flex;
  align-items:center;
  gap:14px;
  padding:15px 28px;
  background:rgba(8,18,31,.91);
  border-bottom:1px solid var(--line-soft);
  backdrop-filter:blur(15px);
  -webkit-backdrop-filter:blur(15px);
}
.top h1{margin:0;font-size:21px;line-height:1.2;letter-spacing:-.25px}
.top p{margin:5px 0 0;color:var(--muted);font-size:12px}
.pill{margin-left:auto;display:inline-flex;align-items:center;border:1px solid #24543f;border-radius:999px;padding:6px 10px;font-size:11px;font-weight:700;white-space:nowrap}
.green{color:#79e7b4;background:#0a261d}
.menu{display:none;flex:0 0 auto;width:39px;height:39px;border:1px solid var(--line);border-radius:10px;background:#102039;color:white;cursor:pointer;font-size:18px}

.content{max-width:1600px;padding:26px 28px 42px}
.content>h2,.content>h3{margin-top:0}

.grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:18px}
.two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}

.card{
  background:linear-gradient(180deg,rgba(15,30,50,.98),rgba(11,24,41,.98));
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:20px;
  box-shadow:var(--shadow);
}
.card+.card{margin-top:16px}
.card h2,.card h3{margin:0 0 14px;font-size:16px;letter-spacing:-.15px}
.card p:first-child{margin-top:0}
.card p:last-child{margin-bottom:0}
.stat{position:relative;overflow:hidden;min-height:122px}
.stat:after{content:"";position:absolute;right:-25px;bottom:-32px;width:105px;height:105px;border-radius:50%;background:rgba(59,130,246,.07)}
.stat b{position:relative;z-index:1;display:block;margin-top:9px;font-size:29px;line-height:1.1;letter-spacing:-1px}
.muted{color:var(--muted)}

.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:40px;
  padding:9px 15px;
  border:1px solid transparent;
  border-radius:9px;
  background:linear-gradient(180deg,#3b82f6,#2563eb);
  color:white;
  text-decoration:none;
  font-size:13px;
  font-weight:700;
  cursor:pointer;
  box-shadow:0 7px 18px rgba(37,99,235,.18);
  transition:filter .15s ease,transform .15s ease,border-color .15s ease;
}
.btn:hover{filter:brightness(1.08);transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn.secondary{background:#14263d;border-color:#28405e;box-shadow:none;color:#d8e5f6}
.btn.danger{background:#9f262a;border-color:#bb383d;box-shadow:none}

label{display:block;margin:13px 0 6px;color:#aabbd0;font-size:11px;font-weight:700;letter-spacing:.2px}
input,select,textarea{
  width:100%;
  min-height:42px;
  padding:10px 12px;
  border:1px solid #294360;
  border-radius:9px;
  outline:none;
  background:#081522;
  color:var(--text);
  transition:border-color .15s ease,box-shadow .15s ease,background .15s ease;
}
textarea{min-height:105px;resize:vertical}
input::placeholder,textarea::placeholder{color:#546d8c}
input:focus,select:focus,textarea:focus{border-color:#3b82f6;box-shadow:0 0 0 3px rgba(59,130,246,.13);background:#0a1828}
select{appearance:auto}
.form{width:100%;max-width:780px}
.form .btn{margin-top:16px}

.table-wrap{
  width:100%;
  overflow:auto;
  margin-top:14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#0c192a;
  box-shadow:var(--shadow);
}
table{width:100%;min-width:760px;border-collapse:collapse;background:transparent}
th,td{padding:12px 14px;border-bottom:1px solid var(--line-soft);text-align:left;font-size:12px;vertical-align:middle}
th{position:sticky;top:0;z-index:1;background:#0b1727;color:#8199b7;font-size:10px;font-weight:800;letter-spacing:.45px;text-transform:uppercase;white-space:nowrap}
tbody tr{transition:background .14s ease}
tbody tr:hover{background:#102239}
tbody tr:last-child td{border-bottom:0}
td .btn{min-height:33px;padding:6px 10px;font-size:11px}

.badge{display:inline-flex;align-items:center;padding:4px 8px;border:1px solid #284863;border-radius:999px;background:#112c42;color:#bed9ee;font-size:10px;font-weight:700;white-space:nowrap}
.alert{padding:12px 14px;margin:0 0 16px;border-radius:10px;font-size:13px;line-height:1.45}
.ok{background:#0b2b20;border:1px solid #20583f;color:#a4ebc8}
.bad{background:#32151b;border:1px solid #6f303b;color:#ffc2c9}

.code{
  overflow:auto;
  white-space:pre-wrap;
  word-break:break-word;
  padding:14px;
  border:1px solid #1d3550;
  border-radius:10px;
  background:#06101c;
  color:#b8d4f7;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:12px;
  line-height:1.55;
}

/* Login page */
body>div[style*="place-items:center"]{background:radial-gradient(circle at 50% 16%,rgba(37,99,235,.15),transparent 26rem)}
body>div[style*="place-items:center"] .card{border-color:#244261;box-shadow:0 28px 75px rgba(0,0,0,.35)}
body>div[style*="place-items:center"] .brand{padding-left:0;padding-right:0}

@media (max-width:1180px){
  .grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media (max-width:820px){
  body.sidebar-open{overflow:hidden}
  .sidebar{width:278px;transform:translateX(-102%);transition:transform .2s ease;box-shadow:18px 0 50px rgba(0,0,0,.38)}
  .sidebar.open{transform:translateX(0)}
  .main{margin-left:0}
  .menu{display:grid;place-items:center}
  .top{min-height:72px;padding:12px 16px}
  .top h1{font-size:18px}
  .content{padding:18px 16px 34px}
  .pill{display:none}
  .two{grid-template-columns:1fr}
}

@media (max-width:560px){
  .grid{grid-template-columns:1fr;gap:12px}
  .card{padding:16px;border-radius:12px}
  .stat{min-height:105px}
  .stat b{font-size:25px}
  .content{padding:14px 12px 28px}
  .top{padding-left:12px;padding-right:12px}
  .top p{display:none}
  .row>.btn{flex:1 1 auto}
  .form{max-width:none}
  .table-wrap{border-radius:10px;margin-top:12px}
  th,td{padding:10px 12px}
}

/* ===== Phone / tablet drawer fix ===== */
.sidebar-backdrop{
  display:none;
  position:fixed;
  inset:0;
  z-index:45;
  background:rgba(2,8,16,.72);
  backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);
}

@media (max-width:1100px){
  body.sidebar-open{overflow:hidden}
  .sidebar{
    width:min(86vw,340px);
    max-width:340px;
    transform:translateX(-105%);
    transition:transform .22s ease;
    box-shadow:18px 0 55px rgba(0,0,0,.48);
  }
  .sidebar.open{transform:translateX(0)}
  .sidebar.open + .sidebar-backdrop{display:block}
  .main{margin-left:0;width:100%}
  .menu{display:grid;place-items:center}
  .top{min-height:72px;padding:12px 16px}
  .content{width:100%;max-width:none;padding:18px 16px 34px}
  .two{grid-template-columns:1fr}
}

/* Force the phone layout even when Chrome "Desktop site" is enabled. */
html.touch-mobile body.sidebar-open{overflow:hidden}
html.touch-mobile .sidebar{
  width:min(86vw,340px);
  max-width:340px;
  transform:translateX(-105%);
  transition:transform .22s ease;
  box-shadow:18px 0 55px rgba(0,0,0,.48);
  padding:16px 12px 22px;
}
html.touch-mobile .sidebar.open{transform:translateX(0)}
html.touch-mobile .sidebar.open + .sidebar-backdrop{display:block}
html.touch-mobile .main{margin-left:0;width:100%;min-width:0}
html.touch-mobile .menu{display:grid;place-items:center;min-width:42px;width:42px;height:42px;font-size:20px}
html.touch-mobile .top{min-height:72px;padding:12px 14px}
html.touch-mobile .content{width:100%;max-width:none;padding:16px 14px 32px}
html.touch-mobile .pill{display:none}
html.touch-mobile .grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
html.touch-mobile .two{grid-template-columns:1fr}
html.touch-mobile .brand{min-height:68px;padding:6px 8px 16px}
html.touch-mobile .brand b{font-size:17px}
html.touch-mobile .brand small{font-size:9px}
html.touch-mobile .nav-title{padding:15px 12px 6px;font-size:10px;letter-spacing:1.2px}
html.touch-mobile nav a{
  min-height:46px;
  padding:11px 12px;
  margin:3px 0;
  border-radius:10px;
  font-size:14px;
  line-height:1.25;
  white-space:normal;
}
html.touch-mobile .card{padding:17px}
html.touch-mobile .stat{min-height:105px}
html.touch-mobile .stat b{font-size:25px}
html.touch-mobile .table-wrap{max-width:100%}

@media (max-width:560px){
  html.touch-mobile .grid{grid-template-columns:1fr}
  html.touch-mobile .top h1{font-size:19px}
  html.touch-mobile .content{padding:14px 12px 28px}
}
