/* Kingston Security dashboard.
   Dark by default: this is looked at in the middle of the night more often
   than during the day, and a white page at 3am is its own small hostility. */
:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --dim: #6e7681;

  --ok: #3fb950;
  --info: #58a6ff;
  --low: #58a6ff;
  --medium: #d29922;
  --high: #db6d28;
  --critical: #f85149;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

header {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky; top: 0; z-index: 10;
}
header h1 { font-size: 15px; margin: 0; letter-spacing: .5px; font-weight: 600; }
header .spacer { flex: 1; }
header .meta { color: var(--muted); font-size: 12px; }

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

/* The status banner is the one thing that has to be readable from across a
   room, so it gets the colour and the size. */
.banner {
  border-radius: 8px; padding: 20px 24px; margin-bottom: 24px;
  border: 1px solid var(--border); background: var(--panel);
  display: flex; align-items: center; gap: 20px;
}
.banner .dot { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.banner h2 { margin: 0; font-size: 22px; font-weight: 600; }
.banner p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.banner.secure { border-left: 4px solid var(--ok); }
.banner.secure .dot { background: var(--ok); }
.banner.warning { border-left: 4px solid var(--medium); }
.banner.warning .dot { background: var(--medium); }
.banner.high_risk { border-left: 4px solid var(--high); }
.banner.high_risk .dot { background: var(--high); }
.banner.critical { border-left: 4px solid var(--critical); }
.banner.critical .dot { background: var(--critical); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 24px; }
.stat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px;
}
.stat .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.stat .value { font-size: 28px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--dim); font-size: 12px; margin-top: 2px; }

section { margin-bottom: 28px; }
section > h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin: 0 0 10px; font-weight: 600;
}

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  border-bottom: 1px solid var(--border); background: var(--panel-2);
}
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr.clickable:hover { background: var(--panel-2); cursor: pointer; }

.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
}
.pill.online, .pill.ok, .pill.active, .pill.info { background: rgba(63,185,80,.15); color: var(--ok); }
.pill.low { background: rgba(88,166,255,.15); color: var(--low); }
.pill.warning, .pill.medium, .pill.elevated { background: rgba(210,153,34,.15); color: var(--medium); }
.pill.high, .pill.misconfigured, .pill.high_risk { background: rgba(219,109,40,.15); color: var(--high); }
.pill.critical, .pill.failed, .pill.offline { background: rgba(248,81,73,.15); color: var(--critical); }
.pill.unknown, .pill.not_installed, .pill.disabled { background: rgba(139,148,158,.15); color: var(--muted); }

/* The score bar makes a fleet scannable: the eye finds the long red one
   without reading a single number. */
.bar { height: 5px; border-radius: 3px; background: var(--panel-2); overflow: hidden; min-width: 70px; }
.bar > span { display: block; height: 100%; }
.bar.ok > span { background: var(--ok); }
.bar.elevated > span { background: var(--medium); }
.bar.high > span { background: var(--high); }
.bar.critical > span { background: var(--critical); }

.layers { display: flex; flex-wrap: wrap; gap: 6px; }
.layer {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 9px; font-size: 12px; background: var(--panel-2);
}
.layer .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.layer.active .dot { background: var(--ok); }
.layer.warning .dot { background: var(--medium); }
.layer.misconfigured .dot { background: var(--high); }
.layer.failed .dot { background: var(--critical); }
.layer.not_installed .dot { background: var(--dim); }
.layer.unknown .dot { background: var(--muted); }
.layer.not_installed { opacity: .55; }

.empty { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }

/* Login */
.login { max-width: 400px; margin: 100px auto; }
.login .panel { padding: 24px; }
.login h2 { margin: 0 0 6px; font-size: 18px; }
.login p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
input[type=password], input[type=text] {
  width: 100%; padding: 9px 11px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-family: var(--mono); font-size: 13px;
}
button {
  padding: 9px 16px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-size: 13px; cursor: pointer;
}
button:hover { background: var(--border); }
button.primary { background: #1f6feb; border-color: #1f6feb; color: #fff; width: 100%; margin-top: 12px; }
button.primary:hover { background: #388bfd; }
.error { color: var(--critical); font-size: 13px; margin-top: 12px; }

details.detail { border-top: 1px solid var(--border); }
details.detail summary { padding: 10px 14px; cursor: pointer; font-size: 13px; color: var(--muted); }
details.detail pre {
  margin: 0; padding: 0 14px 14px; font-family: var(--mono); font-size: 12px;
  white-space: pre-wrap; word-break: break-word; color: var(--text);
}
