:root {
  --silver: #d4d4d8;
  --line: rgba(228, 228, 231, 0.12);
  --line-strong: rgba(228, 228, 231, 0.22);
  --accent: #ef4444;
  --accent-deep: #dc2626;
  --accent-soft: rgba(239, 68, 68, 0.16);
  --ok: #4ade80;
  --warn: #fbbf24;
  --bg: #09090b;
  --bg-2: #18181b;
  --text: #fafafa;
  --hint: #a1a1aa;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  color-scheme: dark;
}
button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; }

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 55% at 50% -15%, rgba(63, 63, 70, 0.45), transparent 58%),
    linear-gradient(180deg, #0c0c0f 0%, var(--bg) 42%, #050506 100%);
}
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(56px);
  opacity: 0.45;
}
.bg-orb--1 {
  width: min(72vw, 320px); height: min(72vw, 320px);
  top: -12%; left: -18%;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.22), transparent 68%);
  animation: drift1 14s ease-in-out infinite alternate;
}
.bg-orb--2 {
  width: min(58vw, 260px); height: min(58vw, 260px);
  top: 38%; right: -22%;
  background: radial-gradient(circle, rgba(113, 113, 122, 0.28), transparent 70%);
  animation: drift2 18s ease-in-out infinite alternate;
}
.bg-orb--3 {
  width: min(48vw, 200px); height: min(48vw, 200px);
  bottom: 8%; left: 10%;
  background: radial-gradient(circle, rgba(39, 39, 42, 0.5), transparent 72%);
  animation: drift3 12s ease-in-out infinite alternate;
}
.bg-noise {
  position: absolute; inset: 0; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift1 { to { transform: translate(12vw, 8vh) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-10vw, -6vh) scale(1.12); } }
@keyframes drift3 { to { transform: translate(6vw, -4vh) scale(0.95); } }

.boot[hidden],
.app[hidden] { display: none !important; }
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
}
.boot-title { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: 0.02em; }
.boot-sub { margin: 0; color: var(--hint); font-size: 14px; }

.app {
  position: relative; z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(12px + var(--safe-top)) 14px calc(88px + var(--safe-bot));
  display: flex; flex-direction: column; gap: 14px;
}

.top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.brand { margin: 0; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--hint); }
.who { margin: 4px 0 0; font-size: 20px; font-weight: 650; }
.role-pill {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(24, 24, 27, 0.7);
  color: var(--silver);
}

.view { display: flex; flex-direction: column; gap: 12px; }
.glass {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 78%, transparent);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(1.15);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
.card { padding: 16px; }
.card h2 { margin: 0 0 6px; font-size: 18px; }
.fine { margin: 0; color: var(--hint); font-size: 13px; line-height: 1.45; }
.row {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  margin: 8px 0 0; font-size: 14px;
}
.row span { color: var(--hint); }
.row strong { font-weight: 650; }

.led {
  width: 10px; height: 10px; border-radius: 50%;
  background: #3f3f46; box-shadow: 0 0 0 3px rgba(63, 63, 70, 0.25);
}
.led.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18); }
.led.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18); }
.led.off { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.server {
  display: flex; gap: 12px; align-items: center; padding: 14px 16px;
}
.server-copy { flex: 1; min-width: 0; }
.server-name { margin: 0; font-weight: 650; }
.server-meta { margin: 3px 0 0; font-size: 12px; color: var(--hint); }
.server-ms { font-variant-numeric: tabular-nums; color: var(--silver); font-size: 13px; }

.people-head { display: flex; gap: 8px; }
.search {
  flex: 1;
  border: 1px solid var(--line-strong);
  background: #0c0c0f;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
.search:focus { border-color: rgba(239, 68, 68, 0.55); }

.list { list-style: none; margin: 0; padding: 0; }
.person {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}
.person:last-child { border-bottom: 0; }
.person-name { margin: 0; font-weight: 650; }
.pill {
  margin-left: auto;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--silver);
  white-space: nowrap;
}
.pill.active { color: #052e16; background: var(--ok); border-color: transparent; }
.pill.reserved { color: #422006; background: var(--warn); border-color: transparent; }
.pill.expired, .pill.revoked { color: #fff; background: #3f3f46; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .btn, .ghost {
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #121214;
  padding: 10px 12px;
  color: var(--text);
}
.chip.is-on, .btn {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  font-weight: 650;
}
.btn { width: 100%; padding: 13px 14px; }
.btn[disabled] { opacity: 0.45; }
.ghost { background: transparent; }
.danger { background: transparent; border-color: rgba(239, 68, 68, 0.45); color: #fca5a5; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--hint); letter-spacing: 0.04em; text-transform: uppercase; }
.field input, .field textarea {
  border: 1px solid var(--line-strong);
  background: #0c0c0f;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
.field textarea { min-height: 72px; resize: vertical; }
.term-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.term-grid input { width: 100%; text-align: center; }
.term-grid small { display: block; text-align: center; color: var(--hint); font-size: 11px; margin-top: 4px; }
.preview {
  margin: 0;
  font-size: 13px;
  color: var(--silver);
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
}

.back {
  align-self: flex-start;
  border: 0;
  background: transparent;
  color: var(--silver);
  padding: 0 0 4px;
}

.dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(10px + var(--safe-bot));
  width: min(452px, calc(100% - 24px));
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 6px;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(9, 9, 11, 0.78);
  backdrop-filter: blur(18px);
  z-index: 5;
}
.dock button {
  border: 0;
  background: transparent;
  color: var(--hint);
  padding: 10px 6px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 650;
}
.dock button.is-on { background: var(--accent-soft); color: #fff; }

.empty { padding: 28px 16px; text-align: center; color: var(--hint); }
.err { color: #fca5a5; font-size: 13px; margin: 0; }
.okmsg { color: var(--ok); font-size: 13px; margin: 0; }
