:root {
  --bg: #0b0f16;
  --panel: #131926;
  --panel-2: #182031;
  --line: #232d42;
  --text: #e6ecf7;
  --muted: #8595b0;
  --accent: #4da3ff;
  --ok: #3ddc97;
  --warn: #ffc453;
  --bad: #ff6b6b;
  --radius: 14px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100%;
}

body {
  background-image:
    radial-gradient(900px 500px at 15% -10%, rgba(77, 163, 255, 0.09), transparent),
    radial-gradient(700px 400px at 100% 0%, rgba(61, 220, 151, 0.06), transparent);
}

/* --- Layout -------------------------------------------------------------- */

.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px 26px 60px;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.15);
  animation: pulse 2.4s ease-in-out infinite;
}
.brand .dot.stale { background: var(--warn); box-shadow: 0 0 0 4px rgba(255,196,83,.15); }
.brand .dot.down  { background: var(--bad); box-shadow: 0 0 0 4px rgba(255,107,107,.15); animation: none; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.brand h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: .2px; }
.brand .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.meta-row { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.meta-item { text-align: right; }
.meta-item .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.meta-item .v { font-size: 13px; font-family: var(--mono); margin-top: 3px; }

/* --- Sections ------------------------------------------------------------ */

.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin: 30px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

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

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 10px;
  position: relative;
  overflow: hidden;
  min-height: 132px;
  display: flex;
  flex-direction: column;
}

.card .label {
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card .value {
  font-size: 30px;
  font-weight: 620;
  font-family: var(--mono);
  margin-top: 10px;
  line-height: 1.05;
  letter-spacing: -.5px;
  transition: color .25s ease;
}
.card .value .unit { font-size: 14px; color: var(--muted); margin-left: 5px; font-weight: 400; }
.card .value.flash { color: var(--accent); }
.card .sub { font-size: 11.5px; color: var(--muted); margin-top: 5px; min-height: 15px; }

.card canvas { width: 100%; height: 42px; margin-top: auto; display: block; }

.card.wide { grid-column: span 2; }
@media (max-width: 620px) { .card.wide { grid-column: span 1; } }

.card.hero { min-height: 168px; }
.card.hero .value { font-size: 46px; }

.badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
}
.badge.ok   { color: var(--ok);   border-color: rgba(61,220,151,.35); }
.badge.warn { color: var(--warn); border-color: rgba(255,196,83,.35); }
.badge.bad  { color: var(--bad);  border-color: rgba(255,107,107,.35); }

.err {
  background: rgba(255, 107, 107, .08);
  border: 1px solid rgba(255, 107, 107, .3);
  color: #ffb3b3;
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 12.5px;
  font-family: var(--mono);
  margin-bottom: 14px;
  word-break: break-word;
}
.err:empty { display: none; }

.info-strip {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px;
}
.info-strip .chip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12px;
}
.info-strip .chip b { color: var(--muted); font-weight: 500; margin-right: 6px; font-size: 11px; }

/* --- Viewing protections ------------------------------------------------- */

/* Repeating identity watermark. Deters casual sharing of screenshots by
   making every capture traceable -- it does not prevent capture. */
#watermark {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  opacity: .05;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  transform: rotate(-24deg) scale(1.6);
  transform-origin: center;
  user-select: none;
}
#watermark span {
  font-family: var(--mono);
  font-size: 13px;
  white-space: nowrap;
  padding: 26px 30px;
  color: var(--text);
}

/* Blanks the content when the tab loses focus, which is when most casual
   screen-grabs and screen-shares happen. */
#guard {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(11, 15, 22, .96);
  backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  padding: 24px;
}
#guard.on { display: flex; }
#guard .lock { font-size: 30px; }
#guard h2 { margin: 0; font-size: 17px; font-weight: 600; }
#guard p { margin: 0; color: var(--muted); font-size: 13px; max-width: 380px; }

body.guarded .wrap { filter: blur(18px); }

@media print {
  /* Not a real protection -- a screenshot bypasses it -- but it removes the
     one-click "print to PDF" path. */
  body { display: none !important; }
}

/* --- Forms / auxiliary pages --------------------------------------------- */

.centre {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 32px;
  width: 100%;
  max-width: 520px;
}
.panel h1 { margin: 0 0 6px; font-size: 20px; }
.panel p.lead { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

label.field { display: block; margin-bottom: 16px; }
label.field span {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); margin-bottom: 7px;
}

input[type="text"], input[type="password"] {
  width: 100%;
  background: #0d1220;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14px;
  font-family: var(--sans);
}
input:focus { outline: none; border-color: var(--accent); }

button {
  background: var(--accent);
  color: #04101f;
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--line);
}
button.danger { background: transparent; color: var(--bad); border: 1px solid rgba(255,107,107,.4); }
button.small { padding: 6px 11px; font-size: 12px; }

.code-box {
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: 3px;
  background: #0d1220;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin: 18px 0;
  color: var(--accent);
}

.note {
  font-size: 12.5px; color: var(--muted); line-height: 1.6;
  border-left: 2px solid var(--line); padding-left: 12px; margin-top: 18px;
}

table.devices { width: 100%; border-collapse: collapse; font-size: 13px; }
table.devices th {
  text-align: left; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); font-weight: 500;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
table.devices td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.devices tr:hover td { background: rgba(255,255,255,.015); }
table.devices .mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.actions { display: flex; gap: 7px; flex-wrap: wrap; }

.status-pill {
  font-size: 11px; padding: 3px 9px; border-radius: 20px; font-family: var(--mono);
}
.status-pill.pending  { background: rgba(255,196,83,.13); color: var(--warn); }
.status-pill.approved { background: rgba(61,220,151,.13); color: var(--ok); }
.status-pill.revoked  { background: rgba(255,107,107,.13); color: var(--bad); }
