:root {
  color: #e8eef7;
  background: #07111f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --bg: #07111f;
  --surface: #0c192a;
  --surface-strong: #122239;
  --border: #21344c;
  --muted: #8ca0b9;
  --text: #e8eef7;
  --teal: #35d4ba;
  --teal-dark: #0e806f;
  --blue: #59a7ff;
  --amber: #f4b860;
  --red: #ff6b78;
  --shadow: 0 24px 70px rgb(0 0 0 / 30%);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgb(27 102 120 / 26%), transparent 32rem),
    radial-gradient(circle at 90% 20%, rgb(34 77 138 / 20%), transparent 30rem),
    var(--bg);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid rgb(140 160 185 / 14%);
  background: rgb(7 17 31 / 72%);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  color: #05221e;
  background: linear-gradient(145deg, #6ee8d4, #22bea5);
  box-shadow: 0 10px 30px rgb(53 212 186 / 22%);
  font-weight: 900;
}

.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }

.health {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: .84rem;
}

.health > span:first-child {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgb(244 184 96 / 10%);
}

.health[data-state="online"] > span:first-child { background: var(--teal); box-shadow: 0 0 0 4px rgb(53 212 186 / 10%); }
.health[data-state="offline"] > span:first-child { background: var(--red); box-shadow: 0 0 0 4px rgb(255 107 120 / 10%); }

main {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(44px, 7vw, 88px) 0 80px;
}

.login-card {
  width: min(760px, 100%);
  margin: 4vh auto 0;
  padding: clamp(28px, 5vw, 52px);
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(145deg, rgb(18 34 57 / 96%), rgb(9 23 39 / 96%));
  box-shadow: var(--shadow);
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--teal);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.03; letter-spacing: -.055em; }
h2 { margin-bottom: 6px; font-size: 1.2rem; letter-spacing: -.02em; }
p { color: var(--muted); line-height: 1.65; }

.login-card > p { max-width: 590px; }
form { margin-top: 32px; }
label { color: #bdcadd; font-size: .82rem; font-weight: 700; }

.token-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 9px; }
input, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  background: #071321;
  padding: 0 14px;
}
select { padding-right: 34px; }
input:focus, select:focus { border-color: var(--teal-dark); box-shadow: 0 0 0 3px rgb(53 212 186 / 12%); }

.button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 18px;
  font-weight: 760;
}
.button.primary { color: #06211d; background: var(--teal); }
.button.primary:hover { background: #65e3ce; }
.button.secondary { color: var(--text); border-color: var(--border); background: var(--surface-strong); }
.button.ghost { color: var(--muted); border-color: transparent; background: transparent; }
.button.danger { color: white; background: #bd3e4b; }
.entra-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
  text-decoration: none;
}
.entra-button[hidden] { display: none; }

.form-error { min-height: 24px; margin: 8px 0 0; color: #ff9aa4; font-size: .84rem; }
.security-note { display: flex; gap: 12px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--muted); font-size: .84rem; }
.security-note strong { color: var(--amber); }

.dashboard-heading, .panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.dashboard-heading { margin-bottom: 28px; }
.dashboard-heading h1 { margin-bottom: 6px; font-size: clamp(2rem, 4vw, 3.2rem); }
.dashboard-heading p, .panel-heading p { margin-bottom: 0; font-size: .88rem; }
.toolbar { display: flex; gap: 8px; }

.banner { padding: 12px 16px; border: 1px solid rgb(255 107 120 / 40%); border-radius: 10px; color: #ffc1c7; background: rgb(137 37 48 / 20%); }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.summary-card {
  position: relative;
  overflow: hidden;
  min-height: 136px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(145deg, rgb(18 34 57 / 90%), rgb(10 26 43 / 90%));
}
.summary-card::after { position: absolute; right: -15px; bottom: -34px; width: 100px; height: 100px; border-radius: 50%; content: ""; background: currentColor; opacity: .06; }
.summary-card span { display: block; color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.summary-card strong { display: block; margin-top: 14px; color: var(--text); font-size: 2.45rem; line-height: 1; }
.summary-card.total { color: var(--blue); }
.summary-card.online { color: var(--teal); }
.summary-card.offline { color: var(--amber); }
.summary-card.revoked { color: var(--red); }

.enrollment-result { padding: 20px 24px 24px; }
.enrollment-result .token-row { margin-top: 8px; }
.enrollment-result input { font-family: ui-monospace, monospace; font-size: .82rem; }
.enrollment-result p { margin: 10px 0 0; font-size: .8rem; }

.panel { margin-top: 18px; border: 1px solid var(--border); border-radius: 16px; background: rgb(12 25 42 / 88%); box-shadow: 0 14px 40px rgb(0 0 0 / 12%); }
.panel-heading { padding: 22px 24px; border-bottom: 1px solid var(--border); }
.customer-form { width: min(460px, 100%); margin: 0; }
.customer-form > label, .compact-field > span { display: block; margin-bottom: 7px; }
.compact-row { display: grid; grid-template-columns: minmax(190px, 1fr) auto; gap: 9px; }
.compact-row input, .compact-field select { min-height: 40px; }
.customer-panel .form-error { padding: 0 24px; }
.customer-count { margin: 0; padding: 0 24px 20px; font-size: .82rem; }
.enrollment-actions, .inventory-filters { display: flex; align-items: end; gap: 10px; }
.compact-field { min-width: 220px; }
.compact-field select { width: 100%; color: var(--text); background-color: #071321; }
.search { width: min(300px, 100%); }
.search span { display: block; margin-bottom: 7px; }
.search input { min-height: 40px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 13px 18px; color: #7188a3; background: rgb(7 17 31 / 48%); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
td { padding: 16px 18px; border-top: 1px solid rgb(33 52 76 / 70%); color: #cbd7e7; font-size: .88rem; vertical-align: middle; }
tbody tr:hover { background: rgb(89 167 255 / 3%); }
td strong, td small { display: block; }
td strong { color: var(--text); }
td small { max-width: 230px; margin-top: 4px; overflow: hidden; color: #667d98; font-family: ui-monospace, monospace; font-size: .7rem; text-overflow: ellipsis; }

.status-badge { display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; font-weight: 750; }
.status-badge::before { width: 7px; height: 7px; border-radius: 50%; content: ""; background: currentColor; box-shadow: 0 0 0 4px currentColor; outline: 3px solid var(--surface); }
.status-badge.online { color: var(--teal); }
.status-badge.offline { color: var(--amber); }
.status-badge.revoked { color: var(--red); }
.table-action { border: 0; color: var(--blue); background: transparent; font-weight: 700; }
.table-action:hover { text-decoration: underline; }

.audit-list { display: grid; gap: 0; margin: 0; padding: 8px 24px 20px; list-style: none; }
.audit-list li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 14px 0; border-bottom: 1px solid rgb(33 52 76 / 55%); }
.audit-list li:last-child { border-bottom: 0; }
.audit-marker { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px rgb(89 167 255 / 8%); }
.audit-list strong, .audit-list span { display: block; }
.audit-list strong { font-size: .87rem; }
.audit-list span { margin-top: 4px; color: var(--muted); font-family: ui-monospace, monospace; font-size: .72rem; }
.empty-state { margin: 0; padding: 28px; text-align: center; }

dialog {
  width: min(610px, calc(100% - 32px));
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0;
}
dialog::backdrop { background: rgb(2 8 16 / 76%); backdrop-filter: blur(5px); }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; padding: 24px; border-bottom: 1px solid var(--border); }
.dialog-heading h2 { margin-bottom: 0; font-size: 1.55rem; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); background: transparent; font-size: 1.4rem; }
dl { display: grid; grid-template-columns: 150px 1fr; margin: 0; padding: 8px 24px; }
dt, dd { margin: 0; padding: 13px 0; border-bottom: 1px solid rgb(33 52 76 / 55%); }
dt { color: var(--muted); font-size: .8rem; }
dd { overflow-wrap: anywhere; color: var(--text); font-family: ui-monospace, monospace; font-size: .82rem; }
.dialog-actions { display: flex; align-items: center; justify-content: end; gap: 18px; padding: 20px 24px 24px; }
.revoke-warning { flex: 1; margin: 0; color: #ffb0b8; font-size: .78rem; line-height: 1.45; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

@media (max-width: 820px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-heading, .panel-heading { align-items: stretch; flex-direction: column; }
  .enrollment-actions, .inventory-filters { align-items: stretch; flex-direction: column; }
  .compact-field { width: 100%; }
  .search { width: 100%; }
  th:nth-child(4), td:nth-child(4) { display: none; }
}

@media (max-width: 560px) {
  .topbar { padding-inline: 18px; }
  .health span:last-child { display: none; }
  main { width: min(100% - 24px, 1440px); padding-top: 28px; }
  .login-card { padding: 24px 20px; }
  .token-row { grid-template-columns: 1fr; }
  .compact-row { grid-template-columns: 1fr; }
  .security-note { flex-direction: column; }
  .summary-grid { gap: 10px; }
  .summary-card { min-height: 112px; padding: 17px; }
  .summary-card strong { font-size: 2rem; }
  .toolbar { width: 100%; }
  .toolbar .button { flex: 1; }
  th:nth-child(5), td:nth-child(5) { display: none; }
  dl { grid-template-columns: 1fr; }
  dt { padding-bottom: 4px; border-bottom: 0; }
  dd { padding-top: 0; }
  .dialog-actions { align-items: stretch; flex-direction: column; }
}
