.admin-page {
  min-height: 100vh;
  background: var(--page);
}

.admin-topbar,
.admin-shell {
  width: min(1240px, calc(100% - 48px));
  margin-inline: auto;
}

.admin-topbar {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.admin-topbar-actions > a {
  color: var(--secondary);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.admin-shell {
  padding-block: 64px 96px;
}

.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 36px;
}

.admin-heading p {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 750;
}

.admin-heading h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4rem);
  letter-spacing: -0.06em;
  line-height: 1;
}

.admin-heading > div > span {
  display: block;
  margin-top: 16px;
  color: var(--secondary);
}

.admin-stats {
  display: flex;
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--surface);
}

.admin-stats div {
  min-width: 92px;
  padding: 16px 20px;
}

.admin-stats div + div {
  border-left: 1px solid var(--line-soft);
}

.admin-stats dt {
  color: var(--tertiary);
  font-size: 0.72rem;
}

.admin-stats dd {
  margin: 4px 0 0;
  font-size: 1.35rem;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.admin-message {
  margin: 0 0 24px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  font-size: 0.88rem;
}

.admin-message.is-error {
  border-left-color: var(--danger);
}

.admin-console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: 20px;
}

.admin-list-panel,
.admin-detail {
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--surface);
}

.admin-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.admin-toolbar label {
  display: grid;
  flex: 1;
  gap: 6px;
  color: var(--secondary);
  font-size: 0.74rem;
  font-weight: 650;
}

.admin-toolbar input,
.admin-form input,
.issued-code input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: var(--page);
  color: var(--text);
  font: inherit;
}

.admin-toolbar input:focus,
.admin-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.admin-toolbar button,
.admin-table button,
.issued-code button,
.admin-primary {
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.admin-table-scroll {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.admin-table caption,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.admin-table th,
.admin-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  color: var(--tertiary);
  font-size: 0.7rem;
  font-weight: 700;
}

.admin-table tbody tr.is-selected {
  background: var(--accent-soft);
}

.admin-public-id {
  color: var(--accent-strong);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.admin-badge {
  display: inline-flex;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--secondary);
  font-size: 0.7rem;
}

.admin-badge.is-active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.admin-empty {
  margin: 0;
  padding: 36px;
  color: var(--secondary);
  text-align: center;
}

.admin-detail {
  position: sticky;
  top: 20px;
  padding: 24px;
}

.admin-detail > header {
  padding-bottom: 22px;
}

.admin-detail h2 {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
  font-size: 1.25rem;
  letter-spacing: -0.035em;
}

.admin-detail header p,
.admin-form p {
  margin: 8px 0 0;
  color: var(--secondary);
  font-size: 0.8rem;
  line-height: 1.6;
}

.admin-form {
  display: grid;
  gap: 14px;
  padding-block: 22px;
  border-top: 1px solid var(--line-soft);
}

.admin-form h3 {
  margin: 0;
  font-size: 1rem;
}

.admin-form label,
.issued-code label {
  display: grid;
  gap: 6px;
  color: var(--secondary);
  font-size: 0.74rem;
  font-weight: 650;
}

.admin-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
}

.admin-primary:hover {
  background: var(--accent-strong);
}

.admin-primary.is-danger {
  border-color: var(--danger);
  background: var(--danger);
}

.admin-primary:disabled {
  cursor: wait;
  opacity: 0.55;
}

.issued-code {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}

@media (max-width: 920px) {
  .admin-console { grid-template-columns: 1fr; }
  .admin-detail { position: static; }
}

@media (max-width: 680px) {
  .admin-topbar,
  .admin-shell { width: min(100% - 28px, 520px); }
  .admin-shell { padding-block: 44px 72px; }
  .admin-heading { align-items: stretch; flex-direction: column; }
  .admin-stats div { min-width: 0; flex: 1; padding: 13px; }
  .admin-toolbar { align-items: stretch; flex-direction: column; }
  .admin-toolbar button { width: 100%; }
  .issued-code { grid-template-columns: 1fr; }
}
