:root {
  /* Contrast ladder, darkest to lightest: page -> card -> field. Each step is
     visibly different so forms never sink into their cards. */
  --bg: #0a0e16;
  --panel: #141b28;
  --panel-2: #1e2839;
  --field: #253147;
  --line: #34415a;
  --line-strong: #4a5a7a;
  --text: #eef2f8;
  --muted: #9aa7bd;
  --label: #c3cde0;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --good: #34d399;
  --warn: #f59e0b;
  --bad: #f87171;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(99, 102, 241, 0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, 0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 system-ui, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.7rem 1.4rem;
  background: rgba(20, 27, 40, 0.92);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  /* One wordmark for whichever brand this portal is wearing. */
  background: linear-gradient(100deg, var(--text) 35%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.topbar nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); padding: 0.25rem 0.4rem; border-radius: 6px; }
.topbar nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.topbar nav a.accent { color: var(--accent-2); font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: 0.8rem; color: var(--muted); font-size: 0.9rem; }

.page { max-width: 1080px; margin: 1.6rem auto; padding: 0 1.2rem; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 {
  display: flex; align-items: center; gap: 0.55rem;
  font-size: 0.95rem; margin: 2rem 0 0.7rem;
  color: var(--label); text-transform: uppercase; letter-spacing: 0.07em;
}
h2::before {
  content: ""; width: 4px; height: 1em; border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; }
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 40%), var(--panel);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 1rem 1.2rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}
.card .num { font-size: 2rem; font-weight: 800; }
.card .lbl { color: var(--muted); font-size: 0.85rem; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  color: var(--label); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--panel-2);
}
tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.018); }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: var(--panel-2); }

.badge { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge.active { background: rgba(52, 211, 153, 0.15); color: var(--good); }
.badge.suspended, .badge.disabled, .badge.archived { background: rgba(245, 158, 11, 0.15); color: var(--warn); }
.badge.revoked, .badge.expired { background: rgba(248, 113, 113, 0.15); color: var(--bad); }

form.inline { display: flex; gap: 0.6rem; align-items: end; flex-wrap: wrap; margin: 0.8rem 0; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; color: var(--label); font-weight: 600; }
input, select, textarea {
  background: var(--field); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 0.55rem 0.7rem; font-size: 0.95rem; min-width: 0;
  font-weight: 400;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input::placeholder, textarea::placeholder { color: #7484a0; }
input:hover, select:hover, textarea:hover { border-color: var(--accent); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.28);
  background: #2a3850;
}
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 1.05rem; height: 1.05rem;
}
select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

button {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: white; border: none; border-radius: 8px;
  padding: 0.55rem 1rem; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}
button:hover { filter: brightness(1.12); }
button.ghost {
  background: transparent; color: var(--label);
  border: 1px solid var(--line-strong); box-shadow: none;
}
button.ghost:hover { color: var(--text); border-color: var(--accent); filter: none; }
button.danger {
  background: transparent; color: var(--bad);
  border: 1px solid rgba(248, 113, 113, 0.4); box-shadow: none;
}
button.danger:hover { background: rgba(248, 113, 113, 0.12); filter: none; }
button.small { padding: 0.25rem 0.6rem; font-size: 0.8rem; }

.flash {
  margin-bottom: 1rem; padding: 0.7rem 1rem; border-radius: 10px; font-weight: 600;
  background: rgba(99, 102, 241, 0.15); color: var(--accent-2); border: 1px solid var(--line);
}
.flash.error { background: rgba(248, 113, 113, 0.12); color: var(--bad); }

.login-wrap { max-width: 380px; margin: 10vh auto 0; }
.login-wrap .card { padding: 2rem; }
.login-wrap h1 { text-align: center; }
.login-wrap form { display: flex; flex-direction: column; gap: 0.9rem; }

.activate-code {
  font-size: 1.6rem; letter-spacing: 0.25em; text-transform: uppercase;
  text-align: center; font-family: ui-monospace, Consolas, monospace;
}
.device-preview { margin-top: 1rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }
.reveal {
  background: var(--field); border: 1px dashed var(--accent);
  border-radius: 10px; padding: 0.8rem 1rem; margin-top: 0.8rem;
  font-family: ui-monospace, Consolas, monospace; word-break: break-all;
}
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* Every page carries the two links a store expects to find from anywhere. */
footer.legal {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  padding: 1.6rem 1rem 2.2rem;
  font-size: 0.82rem;
  color: var(--muted);
}
footer.legal a { color: var(--muted); }
footer.legal a:hover { color: var(--text); }
