:root {
  --bg-outer: #c9cbce;
  --bg-app: #0e0f12;
  --bg-card: #16181c;
  --bg-card-2: #1b1e23;
  --bg-pill: #2a2e35;
  --line: #25282e;
  --text: #f4f6f8;
  --text-dim: #8b9099;
  --text-faint: #5d626b;
  --teal: #4fe3d0;
  --teal-glow: rgba(79, 227, 208, 0.45);
  --purple: #9d6bff;
  --purple-bar: #a855f7;
  --green: #43d9a3;
  --amber: #f5b544;
  --red: #f0604d;
  --radius: 18px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Sora', system-ui, sans-serif;
  background: var(--bg-outer);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--text);
}

/* ====== Auth screens ====== */
body.auth { background: var(--bg-app); }
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 36px 32px;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,0.6);
}
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-logo .mark {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(135deg, var(--teal), #2fb9a8);
  display: flex; align-items: center; justify-content: center;
  color: #06120f; font-weight: 800; font-size: 18px;
}
.auth-logo .brand { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.auth-logo .brandsub { color: var(--text-faint); font-size: 12px; }
.auth-card h1 { font-size: 22px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.02em; }
.auth-card .muted { color: var(--text-dim); font-size: 13.5px; margin-bottom: 22px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.auth-card input {
  background: var(--bg-card-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-family: inherit; font-size: 14.5px;
  outline: none; transition: border .15s, box-shadow .15s;
}
.auth-card input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(79,227,208,0.18); }
.btn-primary {
  background: var(--teal); color: #06120f; border: none;
  padding: 13px 16px; border-radius: 11px;
  font-family: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  margin-top: 4px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -6px var(--teal-glow); }
.alert {
  background: rgba(240,96,77,0.12); color: var(--red);
  border: 1px solid rgba(240,96,77,0.3);
  padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px;
}

/* ====== Window shell ====== */
body.app { background: var(--bg-outer); align-items: flex-start; padding-top: 32px; }
.window {
  width: 100%; max-width: 1240px;
  background: var(--bg-app);
  border-radius: 22px;
  box-shadow: 0 40px 90px -20px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04);
  overflow: hidden;
}

/* Title bar */
.titlebar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.logo .mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--teal), #2fb9a8);
  display: flex; align-items: center; justify-content: center;
  color: #06120f; font-weight: 800; font-size: 15px;
}
.titlebar .dot { color: var(--text-faint); }
.tb-note { color: var(--text-dim); font-size: 13.5px; }
.tb-note b { color: var(--teal); font-weight: 600; }
.win-controls { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.win-controls .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 8px var(--teal-glow); animation: liveDot 1.6s ease-in-out infinite; }
@keyframes liveDot { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.win-controls .user { color: var(--text-dim); font-size: 13px; }
.win-controls a { color: var(--text-faint); font-size: 13px; text-decoration: none; transition: color .15s; }
.win-controls a:hover { color: var(--text); }

/* Top nav */
.topnav { display: flex; align-items: center; gap: 22px; padding: 18px 26px; }
.hamburger { display: flex; flex-direction: column; gap: 4px; cursor: pointer; padding: 4px; }
.hamburger span { width: 20px; height: 2px; background: var(--text-dim); border-radius: 2px; }
.nav-divider { width: 1px; height: 22px; background: var(--line); }
.nav-stat { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 14.5px; font-weight: 500; }
.nav-stat svg { color: var(--text-dim); }
.nav-stat .num { font-family: 'JetBrains Mono', monospace; }
.topnav .right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.btn-refresh {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg-pill); color: var(--text);
  border: none; padding: 10px 16px; border-radius: 11px;
  font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .2s, transform .15s;
}
.btn-refresh:hover { background: #353a43; }
.btn-refresh.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Body panel */
.panel { margin: 0 18px 18px; background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--line); padding: 30px 34px 38px; }
.panel-head { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.server-title { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.server-title .pulse-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; margin-right: 10px; background: var(--green); box-shadow: 0 0 8px rgba(67,217,163,0.5); }
.server-title.s-bad .pulse-dot { background: var(--red); box-shadow: 0 0 8px rgba(240,96,77,0.55); }
.server-title.s-warn .pulse-dot { background: var(--amber); box-shadow: 0 0 8px rgba(245,181,68,0.55); }

.seg { margin-left: auto; display: flex; gap: 6px; background: var(--bg-card-2); padding: 5px; border-radius: 12px; }
.seg button { border: none; background: transparent; color: var(--text-dim); font-family: inherit; font-size: 14px; font-weight: 500; padding: 7px 18px; border-radius: 8px; cursor: pointer; transition: all .2s; }
.seg button.active { background: rgba(79,227,208,0.14); color: var(--teal); }

/* Tabs */
.tabs { display: flex; gap: 30px; border-bottom: 1px solid var(--line); margin-bottom: 30px; overflow-x: auto; }
.tab { position: relative; padding: 0 0 16px; cursor: pointer; color: var(--text-dim); font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 8px; transition: color .2s; background: none; border: none; font-family: inherit; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--text); border-radius: 2px; }
.tab .badge { background: var(--bg-pill); color: var(--text-dim); border-radius: 99px; font-size: 11px; padding: 2px 8px; font-family: 'JetBrains Mono', monospace; }
.tab .badge.bad { background: rgba(240,96,77,0.18); color: var(--red); }
.tab .badge.warn { background: rgba(245,181,68,0.18); color: var(--amber); }

.tab-panel { display: none; animation: fade .35s ease; }
.tab-panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Server info grid */
.grid-top { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 48px; margin-bottom: 40px; }
.section-label { font-size: 19px; font-weight: 600; margin-bottom: 20px; letter-spacing: -0.01em; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px 18px; }
.field .k { color: var(--text-faint); font-size: 12.5px; margin-bottom: 7px; }
.field .v { font-size: 14.5px; font-weight: 500; }
.field .v.mono { font-family: 'JetBrains Mono', monospace; font-size: 13.5px; letter-spacing: -0.01em; }

/* Capacity */
.cap-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; }
.cap-head .total { color: var(--text-dim); font-size: 16px; font-family: 'JetBrains Mono', monospace; }
.cap-head .pct { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }
.cap-track { width: 90px; height: 5px; background: var(--bg-pill); border-radius: 3px; overflow: hidden; }
.cap-fill { height: 100%; background: linear-gradient(90deg, var(--purple), #c084fc); border-radius: 3px; transition: width .6s ease; }
.cap-fill.warn { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.cap-fill.bad  { background: linear-gradient(90deg, var(--red), #fb7185); }

.drives { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 18px; }
.drive .dlabel { color: var(--text-faint); font-size: 12px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive .dval { font-size: 13px; font-family: 'JetBrains Mono', monospace; color: var(--text-dim); margin-bottom: 12px; }
.bars { display: flex; gap: 4px; align-items: flex-end; height: 42px; }
.bars i { flex: 1; background: var(--purple-bar); border-radius: 2px; display: block; opacity: 0.92; animation: pulse 2.4s ease-in-out infinite; }
.bars i.warn { background: var(--amber); }
.bars i.bad  { background: var(--red); }
.drive.idle .bars i { background: #4a4f57; opacity: 0.55; animation: none; }
@keyframes pulse { 0%,100% { transform: scaleY(0.82); } 50% { transform: scaleY(1); } }

/* lower grid */
.grid-bottom { display: grid; grid-template-columns: 0.7fr 0.9fr 1.4fr; gap: 44px; }

/* Health meter */
.health-wrap { display: flex; gap: 20px; }
.health-bar {
  width: 26px; border-radius: 8px; position: relative;
  background: linear-gradient(to top, var(--red) 0%, var(--amber) 28%, #d4e34a 50%, var(--green) 72%, var(--teal) 100%);
  height: 200px;
  -webkit-mask: repeating-linear-gradient(to top, #000 0 7px, transparent 7px 10px);
          mask: repeating-linear-gradient(to top, #000 0 7px, transparent 7px 10px);
}
.health-scale { display: flex; flex-direction: column; justify-content: space-between; height: 200px; color: var(--text-faint); font-size: 12px; }
.health-info .big { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.health-info .big span { font-size: 18px; color: var(--text-dim); }
.health-info .word { color: var(--teal); font-size: 14px; font-weight: 500; margin-bottom: 60px; }
.health-info .word.warn { color: var(--amber); }
.health-info .word.bad  { color: var(--red); }
.health-info .desc { color: var(--text-dim); font-size: 13px; line-height: 1.5; max-width: 130px; }

/* Temperature */
.temp-scale { display: flex; justify-content: space-between; color: var(--text-faint); font-size: 12px; font-family: 'JetBrains Mono', monospace; margin-bottom: 14px; }
.temp-ticks { display: flex; gap: 3px; align-items: center; height: 22px; margin-bottom: 6px; }
.temp-ticks i { flex: 1; height: 12px; background: #3a3f47; border-radius: 1px; }
.temp-ticks i.tall { height: 22px; background: var(--text); }
.temp-curve { height: 40px; width: 100%; }
.temp-val { text-align: center; margin-top: 8px; }
.temp-val .big { font-size: 30px; font-weight: 700; }
.temp-val .big span { font-size: 16px; color: var(--text-dim); }
.temp-val .word { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

/* Performance gauges */
.perf-row { display: flex; align-items: center; gap: 30px; flex-wrap: wrap; }
.gauge { position: relative; width: 150px; height: 150px; }
.gauge svg { transform: rotate(-90deg); }
.gauge .track { fill: none; stroke: #2a2e35; stroke-width: 6; }
.gauge .prog { fill: none; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.gauge.cpu .prog { stroke: #cdd2da; }
.gauge.mem .prog { stroke: var(--teal); filter: drop-shadow(0 0 6px var(--teal-glow)); }
.gauge .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge .num { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.gauge .num span { font-size: 16px; color: var(--text-dim); margin-left: 2px; }
.gauge .lbl { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }

.perf-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 36px; }
.pstat .k { color: var(--text-faint); font-size: 12.5px; margin-bottom: 6px; }
.pstat .v { font-size: 24px; font-weight: 700; }
.pstat .v span { font-size: 13px; color: var(--text-dim); font-weight: 500; }
.perf-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.perf-title .unit { color: var(--text-dim); font-size: 14px; }

/* Generic info cards */
.placeholder { color: var(--text-dim); font-size: 14.5px; line-height: 1.7; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; margin-top: 6px; }
.ph-card { background: var(--bg-card-2); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.ph-card h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.ph-card .m { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text-dim); }
.ph-card .big { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); margin-bottom: 4px; }
.status-ok   { color: var(--green); }
.status-warn { color: var(--amber); }
.status-bad  { color: var(--red); }
.status-dot  { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; }
.status-dot.ok { background: var(--green); box-shadow: 0 0 6px rgba(67,217,163,0.45); }
.status-dot.warn { background: var(--amber); }
.status-dot.bad  { background: var(--red); box-shadow: 0 0 6px rgba(240,96,77,0.5); }

/* Apps table */
.apps-table { width: 100%; border-collapse: collapse; margin-top: 18px; }
.apps-table th, .apps-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.apps-table th { color: var(--text-faint); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.apps-table td .mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text-dim); }
.apps-table td a { color: var(--text-dim); text-decoration: none; }
.apps-table td a:hover { color: var(--teal); }

/* Banned IPs list */
.list-tight { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.list-tight li { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text-dim); padding: 6px 10px; background: var(--bg-card-2); border-radius: 6px; display: flex; justify-content: space-between; }

.stale-banner { background: rgba(245,181,68,0.1); color: var(--amber); border: 1px solid rgba(245,181,68,0.3); padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 18px; display: none; }
.stale-banner.visible { display: block; }

@media (max-width: 920px) {
  body { padding: 16px; }
  .panel { margin: 0 8px 12px; padding: 22px 22px 28px; }
  .grid-top, .grid-bottom { grid-template-columns: 1fr; gap: 36px; }
  .summary-grid { grid-template-columns: repeat(2,1fr); }
}

/* ===== AI Analyst panel (added 2026-06-04) ===== */
.ai-panel{margin-top:22px;border:1px solid var(--border,#26303a);border-radius:12px;background:rgba(124,92,255,.05);overflow:hidden}
.ai-head{display:flex;align-items:center;gap:10px;padding:10px 14px;border-bottom:1px solid var(--border,#26303a);font-family:'JetBrains Mono',monospace;font-size:12px}
.ai-dot{width:8px;height:8px;border-radius:50%;background:#7c5cff;box-shadow:0 0 8px #7c5cff;flex:none}
.ai-title{font-weight:600;letter-spacing:.08em;text-transform:uppercase}
.ai-status{color:var(--text-faint,#7a8794);margin-left:auto;display:flex;align-items:center}
.ai-status.working::after{content:'';display:inline-block;width:10px;height:10px;margin-left:7px;border:2px solid #7c5cff;border-top-color:transparent;border-radius:50%;animation:aispin .8s linear infinite}
@keyframes aispin{to{transform:rotate(360deg)}}
.ai-rerun{background:none;border:1px solid var(--border,#26303a);color:inherit;border-radius:8px;padding:3px 10px;font:inherit;font-size:11px;cursor:pointer;flex:none}
.ai-rerun:hover{border-color:#7c5cff}
.ai-body{padding:14px 16px;font-size:13.5px;line-height:1.55}
.ai-body table{width:100%;border-collapse:collapse;margin:10px 0;font-size:12.5px}
.ai-body th,.ai-body td{padding:6px 8px;border-bottom:1px solid var(--border,#26303a);text-align:left}
.ai-body th{color:var(--text-faint,#7a8794);font-weight:600}
.ai-body h3,.ai-body h4{margin:14px 0 6px;font-size:13px}
.ai-body ul{margin:8px 0;padding-left:20px}
.ai-body p{margin:8px 0}
.ai-muted{color:var(--text-faint,#7a8794)}
.ai-verdict{font-weight:600;font-size:14px}
