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

.admin-console__hero,
.admin-denied {
  grid-column: 1 / -1;
}

.admin-console__hero,
.admin-card {
  border: 1px solid rgba(158, 83, 28, 0.42);
  border-radius: 24px;
  background: rgba(255, 252, 247, 0.92);
  box-shadow: 0 18px 46px rgba(77, 48, 24, 0.08);
}

.admin-console__hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
}

.admin-console__hero h1,
.admin-card h2 {
  margin: 4px 0 0;
  color: #3d2a1b;
}

.admin-card {
  padding: 20px;
}

.admin-role-catalog {
  grid-column: 1;
  order: 1;
}

.admin-governance-card {
  grid-column: 1;
  order: 2;
}

.admin-create {
  grid-column: 1;
  order: 3;
}

.admin-managed-users {
  grid-column: 2;
  grid-row: 2 / span 4;
  order: 4;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(247, 239, 229, 0.94)),
    linear-gradient(135deg, rgba(139, 75, 29, 0.08), rgba(13, 57, 91, 0.04));
}

.admin-create__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.admin-create__grid label,
.admin-filter {
  display: grid;
  gap: 6px;
  color: #6d5948;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.admin-create__grid input,
.admin-create__grid select,
.admin-filter select {
  width: 100%;
  border: 1px solid rgba(158, 83, 28, 0.34);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: #3d2a1b;
  padding: 10px 12px;
}

.admin-create__actions {
  display: flex;
  align-items: end;
}

.admin-function-config {
  margin-top: 16px;
  border: 1px solid rgba(158, 83, 28, 0.18);
  border-radius: 18px;
  background: rgba(158, 83, 28, 0.05);
  padding: 14px;
}

.admin-function-config h3 {
  margin: 4px 0 12px;
  color: #5c361d;
}

.admin-function-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 9px;
}

.admin-function-grid label {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(158, 83, 28, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  color: #5c361d;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.01em;
  padding: 9px 10px;
}

.admin-function-grid input {
  accent-color: #8b4b1d;
}

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

.admin-managed-users .admin-card__toolbar {
  align-items: stretch;
  flex-direction: column;
}

.admin-managed-users .admin-filter select {
  min-height: 38px;
}

.admin-managed-users .admin-actions {
  gap: 6px;
}

.admin-managed-users .admin-actions .admin-btn {
  padding: 7px 10px;
}

.admin-table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(158, 83, 28, 0.2);
}

.admin-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.72);
}

.admin-managed-users .admin-table {
  min-width: 0;
}

.admin-managed-users .admin-table thead {
  display: none;
}

.admin-managed-users .admin-table,
.admin-managed-users .admin-table tbody,
.admin-managed-users .admin-table tr,
.admin-managed-users .admin-table td {
  display: block;
}

.admin-managed-users .admin-table tr {
  border-bottom: 1px solid rgba(158, 83, 28, 0.16);
  padding: 12px 0;
}

.admin-managed-users .admin-table tr:last-child {
  border-bottom: 0;
}

.admin-managed-users .admin-table td {
  border-bottom: 0;
  padding: 5px 4px;
}

.admin-managed-users .admin-table td:nth-child(2),
.admin-managed-users .admin-table td:nth-child(5) {
  display: none;
}

.admin-managed-users .admin-table td:nth-child(6) .admin-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-table th,
.admin-table td {
  padding: 13px 14px;
  text-align: start;
  border-bottom: 1px solid rgba(158, 83, 28, 0.14);
  vertical-align: top;
}

.admin-table th {
  color: #7c4a22;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-table td strong,
.admin-table td span,
.admin-table td small {
  display: block;
}

.admin-table td small,
.admin-table td span {
  color: #6d5948;
}

.admin-role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-role-list span {
  border: 1px solid rgba(158, 83, 28, 0.3);
  border-radius: 999px;
  background: rgba(158, 83, 28, 0.08);
  color: #5c361d;
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 800;
}

.admin-role-list--muted {
  margin-top: 8px;
}

.admin-role-list--muted span {
  background: rgba(108, 61, 29, 0.04);
  border-color: rgba(108, 61, 29, 0.18);
  color: #7b6a5d;
  font-size: 0.66rem;
}

.admin-governance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.admin-governance-grid article {
  border: 1px solid rgba(158, 83, 28, 0.24);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  padding: 13px;
}

.admin-governance-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.admin-governance-grid strong,
.admin-governance-grid small {
  display: block;
}

.admin-governance-grid small {
  margin: 4px 0 10px;
  color: #7b6a5d;
  font-weight: 800;
}

.admin-inline-action {
  margin-inline-start: 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(139, 75, 29, 0.12);
  color: #6c3d1d;
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: 900;
  padding: 4px 7px;
}

.admin-inline-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.admin-status {
  width: max-content;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(39, 120, 87, 0.12);
  color: #277857;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.admin-status[data-status='ON_HOLD'],
.admin-status[data-status='SUSPENDED'],
.admin-status[data-status='ACCESS_REVOKED'] {
  background: rgba(188, 105, 28, 0.13);
  color: #9c571b;
}

.admin-status[data-status='DELETED'] {
  background: rgba(139, 42, 42, 0.13);
  color: #8b2a2a;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-btn {
  border: 1px solid rgba(158, 83, 28, 0.3);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 900;
  padding: 8px 12px;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.admin-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.admin-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.admin-btn--primary {
  border-color: #8b4b1d;
  background: linear-gradient(135deg, #8b4b1d, #b66a28);
  color: #fffaf2;
}

.admin-btn--ghost {
  background: rgba(255, 255, 255, 0.84);
  color: #6c3d1d;
}

.admin-btn--warning {
  background: rgba(188, 105, 28, 0.13);
  color: #8b4b1d;
}

.admin-btn--danger {
  border-color: rgba(139, 42, 42, 0.35);
  background: rgba(139, 42, 42, 0.12);
  color: #8b2a2a;
}

.admin-message,
.admin-denied {
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 800;
}

.admin-denied,
.admin-message--error {
  border: 1px solid rgba(139, 42, 42, 0.25);
  background: rgba(139, 42, 42, 0.08);
  color: #8b2a2a;
}

.admin-message--success {
  border: 1px solid rgba(39, 120, 87, 0.25);
  background: rgba(39, 120, 87, 0.08);
  color: #277857;
}

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

  .admin-role-catalog,
  .admin-governance-card,
  .admin-create,
  .admin-managed-users {
    grid-column: 1;
  }

  .admin-managed-users {
    grid-row: auto;
    max-height: none;
    position: static;
  }

  .admin-create__grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-console__hero,
  .admin-card__toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-function-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .admin-create__grid {
    grid-template-columns: 1fr;
  }

  .admin-function-grid {
    grid-template-columns: 1fr;
  }
}
