:root {
  color-scheme: dark;
  --bg: #071312;
  --panel: #102120;
  --panel-strong: #142b2a;
  --line: #28413f;
  --line-soft: #1d3331;
  --ink: #e7f0ec;
  --muted: #98aaa5;
  --accent: #35c990;
  --accent-strong: #58dca8;
  --warning: #ffc85c;
  --danger: #ff7468;
  --danger-soft: #392320;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  align-items: center;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 8px;
  color: #05201a;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.secondary {
  background: #1b3336;
  color: var(--ink);
}

.danger {
  background: var(--danger);
  color: #2d0906;
}

.pageHeader {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 28px clamp(20px, 3vw, 36px) 20px;
}

.pageHeader h1 {
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.1;
  margin: 0 0 8px;
}

.pageHeader p {
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.pageHeader strong {
  color: var(--warning);
}

.headerActions {
  display: flex;
  gap: 12px;
}

.adminLayout {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  padding: 0 clamp(20px, 3vw, 36px) 36px;
}

.adminRail,
.adminMain {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.adminRail {
  align-content: start;
}

.panel,
.tablePanel,
.statCard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.panel h2,
.tablePanel h2 {
  font-size: 22px;
  line-height: 1.15;
  margin: 0;
}

.panel p {
  color: var(--muted);
  font-weight: 700;
  margin: -4px 0 0;
}

.formHint {
  color: var(--warning) !important;
  font-size: 14px;
}

form {
  display: grid;
  gap: 12px;
}

label {
  color: var(--ink);
  display: grid;
  font-weight: 800;
  gap: 6px;
}

input,
textarea {
  background: #081818;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:disabled {
  color: var(--muted);
}

.statsGrid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.statCard {
  display: grid;
  gap: 6px;
  min-height: 110px;
  padding: 20px;
}

.statCard span {
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.statCard strong {
  color: var(--warning);
  font-size: 34px;
  line-height: 1;
}

.adminStatus {
  color: var(--warning);
  font-weight: 800;
  margin: 0;
  min-height: 24px;
}

.adminStatus.error {
  color: var(--danger);
}

.adminStatus.success {
  color: var(--accent);
}

.tablePanel {
  overflow: hidden;
}

.tableHeader {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 18px 22px;
}

.tableHint {
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  margin: 6px 0 0;
}

.countBadge {
  align-items: center;
  background: #1d3836;
  border-radius: 999px;
  color: var(--warning);
  display: inline-flex;
  font-weight: 900;
  justify-content: center;
  min-height: 34px;
  min-width: 34px;
  padding: 4px 10px;
}

.tableWrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 980px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 18px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

td {
  color: var(--ink);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.emptyCell {
  color: var(--muted);
}

.hashText {
  color: var(--muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  max-width: 420px;
  overflow-wrap: anywhere;
}

.statusPill {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  padding: 3px 9px;
}

.statusPill.active,
.statusPill.available {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  color: var(--accent);
}

.statusPill.expired,
.statusPill.revoked {
  border-color: color-mix(in srgb, var(--danger) 52%, var(--line));
  color: var(--danger);
}

.statusPill.redeemed {
  border-color: color-mix(in srgb, var(--warning) 52%, var(--line));
  color: var(--warning);
}

.deviceList {
  display: grid;
  gap: 8px;
}

.deviceItem {
  align-items: start;
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.miniButton {
  border-radius: 6px;
  font-size: 13px;
  min-height: 30px;
  padding: 4px 9px;
}

@media (max-width: 1180px) {
  .adminLayout {
    grid-template-columns: 1fr;
  }

  .statsGrid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 720px) {
  .pageHeader {
    align-items: stretch;
    flex-direction: column;
  }

  .headerActions {
    flex-wrap: wrap;
  }

  .statsGrid {
    grid-template-columns: 1fr;
  }
}
