/* Vibrant Low-Poly tokens, matching the SPA's tailwind theme and deploy/proxy/html/dev-login.html.
   Kept as hand-written CSS on purpose: the panel is one page with no build step, so it can be
   deployed as a plain static asset inside the API image. */
:root {
  --ink: #141d23;
  --muted: #5a6470;
  --line: #dbe4ed;
  --surface: #ffffff;
  --bg: #e6eff8;
  --bg-alt: #f6faff;
  --accent: #326b00;
  --accent-dark: #1e4600;
  --cyan: #50d9fe;
  --danger: #ab3500;
  --danger-bg: #ffdbd0;
  --warn: #8a5a00;
  --warn-bg: #ffeeba;
  --ok: #1e4600;
  --ok-bg: #d6f5c6;
  --info: #005c70;
  --info-bg: #cdefff;
  --shadow: 6px 6px 0 #293138;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
}

.hidden { display: none !important; }

/* ---- Login ------------------------------------------------------------ */

#login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .75rem;
  padding: 36px;
  box-shadow: 8px 8px 0 #293138;
}

h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; }
.sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
/* Turnstile injects a fixed-size iframe; keep it from crowding the submit button. */
.turnstile { margin: 16px 0 4px; min-height: 65px; }

label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }

input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: .5rem;
  font-size: 15px;
  font-family: inherit;
}
input:focus { outline: none; border-color: var(--accent); }

button {
  border: 0;
  border-radius: .5rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  font-size: 14px;
  box-shadow: 0 4px 0 var(--accent-dark);
}
button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--accent-dark); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

button.block { width: 100%; margin-top: 22px; padding: 13px; font-size: 15px; }
button.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 3px 0 var(--line); }
button.danger { background: var(--danger); box-shadow: 0 4px 0 #6e2200; }
button.small { padding: 6px 10px; font-size: 13px; box-shadow: 0 3px 0 var(--accent-dark); }
button.small.ghost { box-shadow: 0 3px 0 var(--line); }
button.small.danger { box-shadow: 0 3px 0 #6e2200; }

.alert {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: .5rem;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 14px;
}
.alert.warn { background: var(--warn-bg); color: var(--warn); }

/* ---- Shell ------------------------------------------------------------ */

header.bar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
header.bar .brand { font-weight: 800; letter-spacing: -.02em; font-size: 17px; }
header.bar .brand span { color: var(--accent); }
header.bar .spacer { flex: 1; }
header.bar .who { color: var(--muted); font-size: 14px; }

main { padding: 24px; max-width: 1400px; margin: 0 auto; }

section { margin-bottom: 32px; }
h2 { font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; }

/* ---- Stat tiles ------------------------------------------------------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 5px solid var(--cyan);
  border-radius: .625rem;
  padding: 14px 16px;
}
.tile .k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tile .v { font-size: 21px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; word-break: break-word; }
.tile .n { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---- Container table -------------------------------------------------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .625rem;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
tr.self td { background: var(--bg-alt); }

.name { font-weight: 700; }
.meta { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--danger-bg); color: var(--danger); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.neutral { background: var(--bg); color: var(--muted); }

/* Usage bar in the CPU / memory columns. */
.bar { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar > i.hot { background: var(--danger); }

.num { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---- Log drawer ------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 29, 35, .55);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 20;
}

.drawer {
  background: var(--surface);
  border-radius: .75rem;
  width: min(1100px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.drawer .head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.drawer .head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.drawer .head .spacer { flex: 1; }

pre.logs {
  margin: 0;
  padding: 16px 20px;
  overflow: auto;
  background: #141d23;
  color: #d7e3ec;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
}

.empty { padding: 32px; text-align: center; color: var(--muted); }

@media (max-width: 640px) {
  main { padding: 16px; }
  header.bar { padding: 12px 16px; }
}
