:root {
  --bg: #0e1117;
  --panel: #151b23;
  --panel-2: #1c232c;
  --border: #2a323d;
  --text: #e6edf3;
  --muted: #8b95a4;
  --accent: #58a6ff;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; line-height: 1.5;
}
[x-cloak] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--bad); min-height: 1.2em; margin-top: 0.5em; }

/* LOGIN */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 32px; width: 100%; max-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card label { display: block; margin: 16px 0 4px; font-weight: 500; }
.login-card input {
  width: 100%; padding: 10px 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.login-card button[type=submit] {
  width: 100%; margin-top: 20px; padding: 10px;
  background: var(--accent); border: 0; border-radius: 8px;
  color: #0b0d10; font-weight: 600; cursor: pointer;
}
.login-card button[type=submit]:disabled { opacity: 0.6; cursor: wait; }

/* DASHBOARD */
.dash { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 18px; border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav button, .topbar nav .ext {
  background: transparent; color: var(--text); border: 0;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  text-decoration: none; font-size: 14px;
}
.topbar nav button:hover, .topbar nav .ext:hover { background: var(--panel-2); }
.topbar nav button.active { background: var(--panel-2); color: var(--accent); }
.topbar .user { display: flex; align-items: center; gap: 12px; color: var(--muted); }

.panel { padding: 18px 24px; max-width: 1400px; margin: 0 auto; width: 100%; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 18px; }
.row { display: flex; gap: 8px; align-items: center; }

button.ghost {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
button.ghost:hover:not(:disabled) { background: var(--panel-2); border-color: var(--accent); }
button.ghost:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost.active { color: var(--accent); border-color: var(--accent); }
button.ghost.primary { background: var(--accent); color: #0b0d10; border-color: var(--accent); font-weight: 600; }
button.ghost.primary:hover:not(:disabled) { background: #79b8ff; border-color: #79b8ff; }
button.ghost.primary:disabled { opacity: 0.6; cursor: wait; }

select {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  padding: 6px 10px; border-radius: 8px; font-size: 13px;
}

/* TABLES */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 10px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--panel-2); color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--panel-2); }
td code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; color: var(--accent); }
td.actions { white-space: nowrap; }
td.actions button { margin-right: 4px; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge.ok { background: rgba(63,185,80,0.15); color: var(--ok); }
.badge.warn { background: rgba(210,153,34,0.15); color: var(--warn); }
.badge.bad { background: rgba(248,81,73,0.15); color: var(--bad); }
.badge.muted { background: rgba(139,149,164,0.15); color: var(--muted); }

.lic-summary { display: flex; gap: 18px; margin-bottom: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.lic-summary strong { color: var(--text); }
.ig-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.ig-meta strong { color: var(--text); }
.stale-banner {
  background: rgba(210,153,34,0.15); color: var(--warn); border: 1px solid rgba(210,153,34,0.35);
  padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px;
}
.stale-banner strong { color: var(--warn); }

pre.logs {
  background: #000; color: #c9d1d9; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; max-height: 70vh; overflow: auto;
  font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; line-height: 1.4;
  white-space: pre-wrap; word-break: break-all; margin: 0;
}

/* MODAL */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 50;
  display: grid; place-items: center; padding: 20px;
}
.modal-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; max-width: 900px; width: 100%; max-height: 90vh; overflow: auto;
}
.modal-card.wide { max-width: 1100px; }
.modal-card.huge { max-width: 1400px; height: 90vh; display: flex; flex-direction: column; }
pre.scrape-log { max-height: 60vh; }
.vnc-iframe { flex: 1; width: 100%; min-height: 600px; border: 1px solid var(--border); border-radius: 8px; background: #000; }
.modal-card pre {
  background: #000; padding: 12px; border-radius: 8px;
  font-size: 12px; color: #c9d1d9; overflow: auto;
}
