.admin-page {
  --admin-line: rgba(255, 255, 255, 0.1);
  --admin-line-strong: rgba(255, 255, 255, 0.17);
  max-width: 1480px;
  padding-bottom: 48px;
}

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

.admin-header h1 {
  margin: 4px 0 6px;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.admin-header p,
.admin-current-user span,
.admin-section-head span {
  color: var(--text-muted);
  font-size: 13px;
}

.admin-eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.admin-current-user {
  min-width: 220px;
  padding-left: 16px;
  border-left: 2px solid var(--accent);
}

.admin-current-user span,
.admin-current-user strong {
  display: block;
}

.admin-current-user strong {
  margin-top: 3px;
  font-size: 14px;
}

.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--admin-line);
}

.admin-tabs button {
  position: relative;
  padding: 12px 18px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.admin-tabs button::after {
  content: '';
  position: absolute;
  right: 18px;
  bottom: -1px;
  left: 18px;
  height: 2px;
  background: transparent;
}

.admin-tabs button:hover,
.admin-tabs button.active {
  color: var(--text);
}

.admin-tabs button.active::after {
  background: var(--accent);
}

.admin-notice {
  margin-bottom: 16px;
  padding: 11px 14px;
  border: 1px solid var(--admin-line);
  border-left-width: 3px;
  background: var(--surface-1);
  font-size: 14px;
}

.admin-notice.success { border-left-color: var(--ok); }
.admin-notice.error { border-left-color: var(--danger); }

.admin-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-config-card,
.admin-form-card,
.admin-list-card {
  border: 1px solid var(--admin-line);
  background: var(--surface-1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.admin-config-card.priorities { grid-column: 1 / -1; }

.admin-section-head {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--admin-line);
}

.admin-section-head h2,
.admin-section-head h3 {
  margin: 0 0 3px;
  font-size: 15px;
  line-height: 1.3;
}

.admin-config-list { padding: 10px; }

.admin-config-row,
.admin-priority-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.admin-priority-row { grid-template-columns: 90px minmax(0, 1fr) auto; }
.admin-config-row:last-child,
.admin-priority-row:last-child { border-bottom: 0; }

.admin-icon-button {
  display: inline-flex;
  min-width: 34px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--admin-line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.admin-icon-button:hover {
  border-color: rgba(16, 185, 129, 0.5);
  color: var(--text);
  background: rgba(16, 185, 129, 0.07);
}

.admin-icon-button.danger:hover {
  border-color: rgba(239, 68, 68, 0.55);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
}

.admin-savebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 13px 16px;
  border: 1px solid var(--admin-line);
  background: var(--surface-1);
}

.admin-savebar span { color: var(--text-muted); font-size: 13px; }

.admin-primary-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid #34d399;
  border-radius: 6px;
  background: var(--accent);
  color: #05251c;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.admin-primary-button:hover { background: #34d399; }
.admin-primary-button:disabled { opacity: 0.55; cursor: wait; }

.admin-split-layout {
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-form-card {
  position: sticky;
  top: 20px;
  padding-bottom: 16px;
}

.admin-form-card > .admin-field,
.admin-form-card > .admin-checkbox,
.admin-form-card > .admin-primary-button {
  margin-right: 16px;
  margin-left: 16px;
}

.admin-field {
  display: block;
  margin-top: 13px;
}

.admin-field > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.admin-field em {
  color: var(--text-faint);
  font-style: normal;
  font-weight: 500;
}

.admin-form-card > .admin-primary-button {
  width: calc(100% - 32px);
  margin-top: 16px;
}

.admin-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 11px;
  border: 1px solid var(--admin-line);
  cursor: pointer;
}

.admin-checkbox input { margin-top: 2px; accent-color: var(--accent); }
.admin-checkbox span,
.admin-checkbox strong,
.admin-checkbox small { display: block; }
.admin-checkbox strong { font-size: 13px; }
.admin-checkbox small { margin-top: 3px; color: var(--text-muted); line-height: 1.35; }
.admin-checkbox.disabled { cursor: not-allowed; opacity: 0.65; }

.admin-list-card { min-width: 0; }
.admin-table-wrap { width: 100%; overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.admin-table th {
  padding: 10px 13px;
  border-bottom: 1px solid var(--admin-line);
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.admin-table td {
  padding: 12px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
  color: var(--text);
  font-size: 13px;
  vertical-align: middle;
}

.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover td { background: rgba(255, 255, 255, 0.018); }
.admin-table td > strong,
.admin-table td > span { display: block; }
.admin-table td > span { margin-top: 3px; color: var(--text-muted); font-size: 12px; }

.admin-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.admin-status,
.admin-role {
  display: inline-flex !important;
  width: fit-content;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid var(--admin-line-strong);
  border-radius: 4px;
  color: var(--text-muted) !important;
  font-size: 11px !important;
  font-weight: 700;
}

.admin-status.active,
.admin-role.admin {
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7 !important;
}

.admin-shortcode {
  color: var(--text) !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px !important;
  letter-spacing: 0.04em;
}

.credential {
  display: flex;
  max-width: 300px;
  align-items: center;
  gap: 5px;
  margin: 2px 0;
}

.credential-value {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
}

.credential-value.is-masked {
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
}

.credential-action {
  display: inline-flex;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}

.credential-action:hover { background: var(--surface-2); color: var(--text); }
.credential-check { color: var(--ok); }
.credential-empty { color: var(--text-faint); }

.admin-credential-result {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(180px, auto) minmax(180px, auto) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding: 13px 15px;
  border: 1px solid rgba(16, 185, 129, 0.42);
  background: rgba(16, 185, 129, 0.065);
}

.admin-credential-result strong,
.admin-credential-result span { display: block; }
.admin-credential-result span { margin-top: 3px; color: var(--text-muted); font-size: 12px; }

.admin-loading,
.admin-empty-state,
.admin-empty-line {
  padding: 28px 18px;
  color: var(--text-muted);
  text-align: center;
}

.admin-loading .spinner { width: 22px; height: 22px; margin-bottom: 9px; }
.admin-empty-state h3 { margin-bottom: 5px; color: var(--text); font-size: 15px; }
.admin-empty-state p { font-size: 13px; }
.admin-empty-line { padding: 16px 8px; font-size: 13px; }

.admin-access-denied {
  max-width: 540px;
  margin: 12vh auto 0;
  padding: 32px;
  border-left: 3px solid var(--danger);
  background: var(--surface-1);
}

.admin-access-denied > span { color: var(--danger); font-size: 12px; font-weight: 800; letter-spacing: 0.1em; }
.admin-access-denied h1 { margin: 8px 0; }
.admin-access-denied p { color: var(--text-muted); }

.spin { animation: admin-spin 0.8s linear infinite; }
@keyframes admin-spin { to { transform: rotate(360deg); } }

.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;
}

@media (max-width: 1060px) {
  .admin-split-layout { grid-template-columns: 1fr; }
  .admin-form-card { position: static; }
  .admin-credential-result { grid-template-columns: 1fr auto; }
}

@media (max-width: 760px) {
  .admin-page { padding: 16px; }
  .admin-header { align-items: flex-start; flex-direction: column; }
  .admin-current-user { width: 100%; }
  .admin-tabs { overflow-x: auto; }
  .admin-tabs button { flex: 0 0 auto; padding: 11px 12px; }
  .admin-config-grid { grid-template-columns: 1fr; }
  .admin-config-card.priorities { grid-column: auto; }
  .admin-savebar { align-items: stretch; flex-direction: column; }
  .admin-credential-result { grid-template-columns: 1fr; }
}
