@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #050b14;
  --card: rgba(10, 18, 32, 0.85);
  --border: rgba(255, 255, 255, 0.07);
  --border-bright: rgba(94, 164, 255, 0.25);
  --text: #e8f0ff;
  --text-dim: #7a92b8;
  --text-muted: #4a6080;
  --blue: #5ea4ff;
  --blue-dim: rgba(94, 164, 255, 0.12);
  --green: #34d17a;
  --green-dim: rgba(52, 209, 122, 0.12);
  --amber: #ffc147;
  --amber-dim: rgba(255, 193, 71, 0.12);
  --red: #ff4f6e;
  --red-dim: rgba(255, 79, 110, 0.12);
  --sidebar-w: 252px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px rgba(0,0,0,.5);
  --font: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 70% 50% at 5% 0%, rgba(94,164,255,.1) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 95% 100%, rgba(52,209,122,.07) 0%, transparent 50%);
}

a { text-decoration: none; color: inherit; }
button, input { font-family: var(--font); }
button { border: 0; cursor: pointer; }
input { outline: none; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 99px; }

/* LOGIN */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-shell {
  width: 100%; max-width: 400px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 22px; padding: 34px; box-shadow: var(--shadow);
  backdrop-filter: blur(20px); animation: fadeUp .4s ease both;
}
.brand-badge {
  width: 50px; height: 50px; border-radius: 14px;
  background: linear-gradient(135deg, var(--blue), #387dff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px; margin-bottom: 16px;
  box-shadow: 0 6px 20px rgba(94,164,255,.3);
}
.login-shell h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 5px; }
.sub { color: var(--text-dim); font-size: 13px; margin-bottom: 22px; }
.login-card { display: grid; gap: 12px; }
.login-card label { font-size: 12px; color: var(--text-dim); font-weight: 500; margin-bottom: 4px; display: block; }
.login-card input {
  width: 100%; background: rgba(255,255,255,.04); border: 1px solid var(--border);
  color: var(--text); padding: 12px 15px; border-radius: var(--radius-sm); font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.login-card input:focus { border-color: var(--border-bright); box-shadow: 0 0 0 3px rgba(94,164,255,.1); }
.login-card button {
  background: linear-gradient(135deg, var(--blue), #387dff); color: #fff;
  padding: 12px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px;
  transition: transform .15s, box-shadow .15s; box-shadow: 0 4px 14px rgba(94,164,255,.25);
}
.login-card button:hover { transform: translateY(-1px); box-shadow: 0 7px 22px rgba(94,164,255,.38); }
.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 13px; }
.error { background: var(--red-dim); color: #ffc0cc; border: 1px solid rgba(255,79,110,.2); }
.login-hint { margin-top: 14px; color: var(--text-muted); font-size: 12px; }
code { background: rgba(255,255,255,.07); padding: 2px 7px; border-radius: 6px; font-family: var(--mono); font-size: 11px; }

/* APP SHELL */
.app-shell { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  border-right: 1px solid var(--border); padding: 18px 13px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: rgba(4, 8, 16, 0.8); backdrop-filter: blur(24px);
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.logo-row { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.logo-box {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue), #387dff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; box-shadow: 0 4px 12px rgba(94,164,255,.28);
}
.logo-row strong { font-size: 15px; font-weight: 700; }
.logo-sub { font-size: 10.5px; color: var(--text-muted); margin-top: 1px; letter-spacing: .06em; text-transform: uppercase; }

.nav-section { margin-bottom: 4px; }
.nav-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; padding: 10px 10px 5px; }
.nav-link {
  width: 100%; text-align: left; background: transparent; border: 1px solid transparent;
  color: var(--text-dim); padding: 9px 11px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 9px;
  transition: all .15s; cursor: pointer; position: relative;
}
.nav-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; opacity: .7; }
.nav-link:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav-link.active { color: var(--text); background: rgba(94,164,255,.1); border-color: rgba(94,164,255,.18); font-weight: 600; }
.nav-link.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 55%; background: var(--blue); border-radius: 0 3px 3px 0; }

.sidebar-bottom { display: grid; gap: 8px; }
.status-pill { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: var(--radius-sm); background: rgba(255,255,255,.04); border: 1px solid var(--border); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--green); box-shadow: 0 0 8px rgba(52,209,122,.55); animation: dot-pulse 1.8s infinite; }
.dot.offline { background: var(--red); box-shadow: 0 0 8px rgba(255,79,110,.55); animation: none; }
@keyframes dot-pulse { 0%,100% { box-shadow: 0 0 8px rgba(52,209,122,.55); } 50% { box-shadow: 0 0 16px rgba(52,209,122,.85); } }
.logout-btn { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px; border-radius: var(--radius-sm); background: var(--red-dim); border: 1px solid rgba(255,79,110,.18); color: #ffb3c1; font-size: 13px; font-weight: 500; text-decoration: none; transition: background .15s; }
.logout-btn:hover { background: rgba(255,79,110,.22); }

/* MAIN */
.main { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 24px 26px 0; margin-bottom: 22px; }
.topbar-left h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.topbar-left p { color: var(--text-dim); font-size: 13px; margin-top: 3px; }
.topbar-right { display: flex; align-items: center; gap: 9px; }

/* TABS */
.tab { display: none; padding: 0 26px 26px; }
.tab.active { display: block; animation: fadeUp .2s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* CARD */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.35); padding: 20px; backdrop-filter: blur(10px); transition: border-color .2s; }
.card:hover { border-color: rgba(255,255,255,.1); }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 13px; margin-bottom: 16px; }
.stat-card { display: flex; flex-direction: column; gap: 12px; }
.stat-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.stat-icon { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.stat-icon.blue { background: var(--blue-dim); border: 1px solid rgba(94,164,255,.15); }
.stat-icon.green { background: var(--green-dim); border: 1px solid rgba(52,209,122,.15); }
.stat-icon.amber { background: var(--amber-dim); border: 1px solid rgba(255,193,71,.15); }
.stat-icon.red { background: var(--red-dim); border: 1px solid rgba(255,79,110,.15); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.stat-value.online { color: var(--green); }
.stat-value.offline { color: var(--red); }
.stat-sub { font-size: 12px; color: var(--text-muted); }

.two-col { display: grid; grid-template-columns: 1.1fr .9fr; gap: 13px; }

.card-head { margin-bottom: 15px; display: flex; align-items: center; justify-content: space-between; }
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head-title { display: flex; align-items: center; gap: 8px; }

/* ACTIONS */
.action-grid { display: grid; gap: 8px; }
.action-btn { display: flex; align-items: center; gap: 9px; padding: 10px 13px; border-radius: var(--radius-sm); border: 1px solid transparent; color: var(--text); font-size: 13px; font-weight: 500; transition: all .15s; text-align: left; }
.action-btn:hover { transform: translateX(2px); }
.action-btn.success { background: var(--green-dim); border-color: rgba(52,209,122,.18); }
.action-btn.warn { background: var(--amber-dim); border-color: rgba(255,193,71,.18); }
.action-btn.danger { background: var(--red-dim); border-color: rgba(255,79,110,.18); }
.action-btn.blue { background: var(--blue-dim); border-color: rgba(94,164,255,.18); }

/* INFO LIST */
.info-list { display: grid; gap: 0; }
.info-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.info-row:last-child { border-bottom: 0; }
.info-row .key { color: var(--text-dim); }
.info-row .val { font-weight: 500; font-family: var(--mono); font-size: 12px; }

/* BADGE */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.badge.running { background: var(--green-dim); color: #86efb8; border: 1px solid rgba(52,209,122,.2); }
.badge.stopped { background: var(--red-dim); color: #ffc0cc; border: 1px solid rgba(255,79,110,.2); }
.badge.starting { background: var(--amber-dim); color: #fde68a; border: 1px solid rgba(255,193,71,.2); }
.badge.count { background: var(--blue-dim); color: #93c5fd; border: 1px solid rgba(94,164,255,.2); }

/* BUTTONS */
.ghost-btn { background: rgba(255,255,255,.05); border: 1px solid var(--border); color: var(--text-dim); padding: 8px 13px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; }
.ghost-btn:hover { background: rgba(255,255,255,.08); color: var(--text); }
.primary-btn { background: linear-gradient(135deg, var(--blue), #387dff); color: #fff; border: 0; padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(94,164,255,.3); }

.search { background: rgba(255,255,255,.04); border: 1px solid var(--border); color: var(--text); padding: 8px 13px; border-radius: var(--radius-sm); font-size: 13px; width: 210px; transition: border-color .2s; }
.search:focus { border-color: var(--border-bright); }
.search::placeholder { color: var(--text-muted); }

/* TABLE */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 8px 13px; font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 13px; font-size: 13.5px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.02); }

.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.mini { padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; border: 1px solid transparent; transition: all .12s; color: var(--text); }
.mini:hover { transform: scale(1.04); }
.mini.default { background: rgba(255,255,255,.06); border-color: var(--border); }
.mini.warn { background: var(--amber-dim); border-color: rgba(255,193,71,.2); }
.mini.danger { background: var(--red-dim); border-color: rgba(255,79,110,.2); }

/* RESOURCES */
.resource-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.resource-card { padding: 13px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: rgba(255,255,255,.03); transition: border-color .15s, background .15s; }
.resource-card:hover { border-color: rgba(255,255,255,.09); background: rgba(255,255,255,.05); }
.res-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.res-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.res-actions { display: flex; gap: 5px; margin-top: 9px; }

/* CONSOLE */
.console-box { height: 390px; overflow-y: auto; background: #020810; border-radius: var(--radius-sm); border: 1px solid var(--border); padding: 13px; font-family: var(--mono); font-size: 12px; line-height: 1.75; }
.console-line { display: flex; gap: 11px; padding: 1px 0; }
.console-line:hover { background: rgba(255,255,255,.02); border-radius: 4px; padding-left: 4px; }
.c-time { color: #334455; flex-shrink: 0; }
.c-type { flex-shrink: 0; min-width: 58px; font-weight: 600; }
.c-type.info { color: var(--blue); }
.c-type.success { color: var(--green); }
.c-type.warning { color: var(--amber); }
.c-type.error { color: var(--red); }
.c-msg { color: #7aa2bb; word-break: break-all; }

.console-form { display: flex; gap: 9px; margin-top: 13px; }
.console-form input { flex: 1; background: rgba(255,255,255,.04); border: 1px solid var(--border); color: var(--text); padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13px; font-family: var(--mono); transition: border-color .2s; }
.console-form input:focus { border-color: var(--border-bright); }
.console-form input::placeholder { color: var(--text-muted); }

/* UTILS */
.muted { color: var(--text-dim); }
.small { font-size: 12px; color: var(--text-muted); }
.no-data { text-align: center; padding: 28px; color: var(--text-muted); font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12px; }

.skeleton-text { display: inline-block; background: linear-gradient(90deg,rgba(255,255,255,.06) 25%,rgba(255,255,255,.1) 50%,rgba(255,255,255,.06) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; min-width: 70px; height: 1em; vertical-align: middle; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

#lastUpdated { font-size: 12px; color: var(--text-muted); }

@media (max-width: 1200px) { .stats-grid { grid-template-columns: repeat(2,1fr); } .resource-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 860px) { .app-shell { flex-direction: column; } .sidebar { width: 100%; height: auto; position: static; } .stats-grid,.two-col { grid-template-columns: 1fr; } .resource-grid { grid-template-columns: 1fr; } }
